Jump to content

Menu


mikenl

Recommended Posts

I'm trying to make a menu which stays highlighted onclick AND hovers the other menu items on mouseover... The menu is in a frame.

 

I have something like this now - am just trying stuff. The first function works fine (onclick highlight), the second gives problems...

 

Anyone has a clue how to make this work?

 


function navbar(id) {  
for (i=1;i<=6;i++) { 
var navname = 'nav'+i;
var navStyle = document.getElementById(navname).style;  
navStyle.background=(id==navname)?'url(gfx/tab.gif) 0 -31px':'url(gfx/tab.gif)';
navStyle.color=(id==navname)?'#000':'#214d8c';
} 
}

function hoverbar(id) {  
for (i=1;i<=6;i++) { 
var hovername = 'nav'+i;
var hoverStyle = document.getElementById(hovername).style;
if (hoverStyle.background==(id==hovername)=='url(gfx/tab.gif) 0 -31px');
{
hoverStyle.background=(id==hovername)='url(gfx/tab.gif) 0 -31px';
hoverStyle.color=(id==hovername)='#000';
} 
}
}

 

Menu items look like this:

 

<ul>
<li><a href="link1.php" id="nav2" target="mainFrame" onClick="navbar('nav1');" onmouseover="hoverbar('nav1');">TEXT 1</a></li>
<li><a href="link2.php" id="nav3" target="mainFrame" onClick="navbar('nav2');" onmouseover="hoverbar('nav2');">TEXT2</a></li>
etc...
</ul>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.