Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.CSS/javascript based tab menu... so close!!!! 1

Status
Not open for further replies.

rockyroad

Programmer
Feb 22, 2003
191
US
Hello,

I am building a .CSS based menu based on two tutorials I have found.. the first is:


...which I referenced for building the tab's graphics... but this tutorial didn't delve into the javascript/dhtml aspect of the navigation... for this I referred to:


Using these as a guide a built the following:


which is almost exactly what I need, except for one problem... on the currently selected tab, the right side of the "sliding door" bg image is changing per the .CSS ...
Code:
#tablist li a.current{
background-image:url("right_on.gif");
margin-bottom:1px;
}
... however, I need the left side bg image to change as well, but the code I have doesn't do the trick
Code:
#tablist li.current{
/* background: #f7f7f7; */
background-image:url("left_on.gif");
margin-bottom:1px;
}

... so i am stumped...what am I missing here?[banghead]

does anyone have any ideas how to solve this one?

Thanks! :) RR
 
You're missing the fact that your left side changes when you apply .current class to your <li> element. And you only apply that class to the <a> element. To turn that on, you simply need to add [tt]aobject.parentNode.className = "current"[/tt] at the end of your highlighttab function. However, you will still need to turn this current off for the rest of the elements. You could do the same, but I don't know how smart that is. That would require changing your function to look like this altogether:
Code:
function highlighttab (aobject)
{
  if (typeof tabobjlinks=="undefined")
    collecttablinks()
  for (i=0; i<tabobjlinks.length; i++)
  {
    tabobjlinks[i].className=""
    tabobjlinks[i].parentNode.className=""
  }
  aobject.className="current"
  aobject.parentNode.className = "current"
}
 
Vragabond,

Yes, thank you. Sorry it took so long to reply, I had some personal matters to attend to. Thanks again.

Charles
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top