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
    Regular Coder
    Join Date
    Oct 2010
    Posts
    127
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Help with Navigation Menu

    I'm trying to learn to write javascript myself. So please, don't right anything for me, just steer me in the right direction.

    The way I have my my navigation set up is when the user clicks on a section of the main nav, the subnav displays beneath the header (see the pic more a visual idea).



    I want the the subnav for "Services" to be displayed on all pages that are listed under Services. Same thing for everything else on the nav bar.

    They way it's set up right now, the "about" submenu is displayed on every page. If the user clicks on "services" then that submenu displays. Just in case you need it, I'm posting the code for that. Like I said above, please don't write anything for me, just point me in the right direction.

    Code:
    /*Javascript to display Sub Menu */
    
    function showAbout() {
    				 if(subnav.style.display=="none")   {
    				 subnav.style.display="block";
    				 services.style.display="none";
    				 contact.style.display="none";;
    				 partners.style.display="none";
    				 }
    				 else subnav.style.display="none";
    }
    function showServices() {
    				 if(services.style.display=="none"){
    				 services.style.display="block";
    				 subnav.style.display="none";
    				 contact.style.display="none";
    				 partners.style.display="none";
    				 }
    				  else services.style.display="none";
    }
    function showContact() {
    				 if(contact.style.display=="none"){
    				 contact.style.display="block";
    				 subnav.style.display="none";
    				 services.style.display="none";
    				 partners.style.display="none"
    				 }
    				 else contact.style.display="none";
    }
    function showPartners() {
    				 if(partners.style.display=="none"){
    				 partners.style.display="block";
    				 subnav.style.display="none";
    				 services.style.display="none";
    				 contact.style.display="none";
    				 }
    				 else partners.style.display="none";
    			}

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Posts
    454
    Thanks
    0
    Thanked 20 Times in 20 Posts
    use 'location'
    if 'current location' contains the word LowerCase('services') then show services menu one function will work with all pages and directories.
    NO Limits!! DHCreationStation.com
    ------------------------------------------------------------
    Broken items wanted for tinkerin'! PostItNow@BrokenEquipment.com
    Global Complaint Dept.


  •  

    Posting Permissions

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