Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    70
    Thanks
    9
    Thanked 0 Times in 0 Posts

    How do I modify this javascript navigation?

    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?

    Code:
    <!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>

  • #2
    New Coder
    Join Date
    Jun 2006
    Posts
    70
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •