...

View Full Version : How do I modify this javascript navigation?



malhyp
09-04-2008, 10:00 AM
Hi there we have managed to find the following script which is great but there seems to be a problem with it.

When you hover over one of the links, you get a dropdown. If we click onto one of the links in the dropdown and it takes us to the next page the navigation is closed and you have to click it again to find the links.

I am assuming that when you click onto one of the links and you go to the next page that the navigation panel should be open so that visitors to your website can see which page they are on.

Can anyone suggest how we keep one of the navigations open for the 2nd page that one of the links takes you too?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<HEAD>
<script type="text/javascript">
function startmenu()
{
menu0.style.display = "none";
menu1.style.display = "none";
menu2.style.display = "none";
menu3.style.display = "none";
}

function menu0func()
{
if(menu0.style.display == "none")
{
startmenu();
menu0.style.display = "block";
}
else
{
startmenu();
}
}
function menu1func()
{
if(menu1.style.display == "none")
{
startmenu();
menu1.style.display = "block";
}
else
{
startmenu();
}
}
function menu2func()
{
if(menu2.style.display == "none")
{
startmenu();
menu2.style.display = "block";
}
else
{
startmenu();
}
}
function menu3func()
{
if(menu3.style.display == "none")
{
startmenu();
menu3.style.display = "block";
}
else
{
startmenu();
}
}
</script>
</HEAD>
<BODY onLoad="javascript:startmenu()">
<table align="center">
<tr><td>

<a href="javaScript:menu0func()">Links One</a>
<div id="menu0">
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
</div>
<br>
<a href="javaScript:menu1func()">Links Two</a>
<div id="menu1">
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
</div>
<br>
<a href="javaScript:menu2func()">Links Three</a>
<div id="menu2">
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
</div>
<br>
<a href="javaScript:menu3func()">Links Four</a>
<div id="menu3">
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
- <a href='#'>Test</a><br>
</div>

</td></tr>
</table>
<p><center>
<font face="arial, helvetica" size"-2"></font>
</center><p>
<body>
</body>
</html>

malhyp
09-04-2008, 10:07 AM
Also I just noticed that if we change "menu0" to "block", it keeps the navigation open, but when you click onto "menu1", the 1st menu "menu0" dosent close. it stays open pushing your whole page down.

Cheers
Hyerion



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum