Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Problem with panel java script..

Asked Modified Viewed 4,130 times
G
ghx
G
ghx 10
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
asked
Newbie

Hello,
i am trying to create panel which shows the latest content of my site but i'm new to this and have some problems get it working.
My question is where, in which files i have to add the code bellow:

java code:

<script type="text/javascript">
function news(n) {
    if (n == "games")
        document.getElementById("news").innerHTML = "Yay, games!";
    else if (n == "soft")
        document.getElementById("news").innerHTML = "Yay, software!";
    else if (n == "other")
        document.getElementById("news").innerHTML = "Yay, other stuff!";
}



and

html code:

<ul>
    <li><a href="" onmouseover="news('games')"/>Games</li>
    <li><a href="" onmouseover="news('soft')"/>Software</li>
    <li><a href="" onmouseover="news('other')"/>Other</li>
</ul>
<div id="news">
</div></script>


and how to make it work that way - when mouse over left side menu, in table box next to the menu is shown the latest content
of my site, for example the mouse is over menu section - software
and in the box is shown the latest content of software, the mouse move over - news, latest in news is shown in the box, the same for forum treads and other....


Thank you in advance i will be very appreciated.
Edited by ghx on 01-04-2009 05:34,
0 replies

3 posts

U
Ugleh
U
Ugleh 10
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

Can you please explain what you have tried, exc. Have you used the Echo statement? exc. All would be nice to hear. but best to do is:

echo '<script type="text/javascript">
function news(n) {
    if (n == "games")
        document.getElementById("news").innerHTML = "Yay, games!";
    else if (n == "soft")
        document.getElementById("news").innerHTML = "Yay, software!";
    else if (n == "other")
        document.getElementById("news").innerHTML = "Yay, other stuff!";
}';
echo'<ul>
    <li><a href="" onmouseover="news('games')"/>Games</li>
    <li><a href="" onmouseover="news('soft')"/>Software</li>
    <li><a href="" onmouseover="news('other')"/>Other</li>
</ul>
<div id="news">
</div></script>
';

See if that works, Im not positive about if it works or not because Im at work trying to keep ocupied and not infront of my personal PC.
0 replies
S
st3ff3n
S
  • Junior Member, joined since
  • Contributed 27 posts on the community forums.
  • Started 11 threads in the forums
answered
Junior Member

You'll have to change every " in the script code into a '

Try this:
<script type='text/javascript'>
function news(n) {
    if (n == 'games')
        document.getElementById('news').innerHTML = 'Yay, games!';
    else if (n == 'soft')
        document.getElementById('news').innerHTML = 'Yay, software!';
    else if (n == 'other')
        document.getElementById('news').innerHTML = 'Yay, other stuff!';
}


And the HTML-code..
<ul>
    <li><a href='' onmouseover='news('games')'/>Games</li>
    <li><a href='' onmouseover='news('soft')'/>Software</li>
    <li><a href='' onmouseover='news('other')'/>Other</li>
</ul>
<div id='news'>
</div></script>


Put these into a new element.
You can create new elements from the System area in your admin panel.
It should look like this:


openside("put-the-name-of-the-panel-here");
  echo "<script type='text/javascript'>
function news(n) {
    if (n == 'games')
        document.getElementById('news').innerHTML = 'Yay, games!';
    else if (n == 'soft')
        document.getElementById('news').innerHTML = 'Yay, software!';
    else if (n == 'other')
        document.getElementById('news').innerHTML = 'Yay, other stuff!';
}  <ul>
    <li><a href='' onmouseover='news('games')'/>Games</li>
    <li><a href='' onmouseover='news('soft')'/>Software</li>
    <li><a href='' onmouseover='news('other')'/>Other</li>
</ul>
<div id='news'>
</div></script>";
closeside();


Can't guarantee it will work, though - but chaning every " into a ' is a good start:)
Edited by st3ff3n on 12-03-2009 18:33,
0 replies
G
ghx
G
ghx 10
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie

Thank you very much for your reply
i think i found to make it work.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

U
U
Ugleh 10
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 27 threads in the forums
S
S
  • Junior Member, joined since
  • Contributed 27 posts on the community forums.
  • Started 11 threads in the forums
G
G
ghx 10
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet