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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript-Menue: Remember open menues

Status
Not open for further replies.

BennySHS

Programmer
Mar 15, 2005
32
DE
hi again,

here I am with another little problem...

I'm trying to make a javascript-menue where you can open the submenues with javascript.

the html:

<div style="float:left">
<a href="#" onClick="setVisibility('benutzer_bearbeiten_sub');" class="navbutton">Benutzer-Verwaltung</a>

<div id="benutzer_bearbeiten_sub" class="hidden">
<a href="benutzer_anlegen.php" class="navbutton_upunkt">Benutzer anlegen</a>
<a href="benutzer_bearbeiten.php" class="navbutton_upunkt">Benutzer bearbeiten</a>
</div>

</div>

the js:
<script language="JavaScript" type="text/JavaScript">
<!--
function setVisibility(strId)
{
if (document.getElementById(strId).className == "hidden")
{
document.getElementById(strId).className="visible";
}
else
{
document.getElementById(strId).className="hidden";
}
}
//-->
</script>

The problem:
When I open a submenu and Click on a link on it, on the next page the submenue is closed.
Is there a way to solve this with javascript?
thank you very much,
greets ben
 
You would have to have some code on the next page that "knows where it lives in the navigation structure" and expands the navigation menu (on page loaded) to reflect the page location.

You can also pass information via the href (contact.html?nav1=3&nav2=1) using a GET and collect that information on the new page. This is probably more convenient and allows for one common method for all your pages.

Cheers,
Jeff


[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top