Results 1 to 4 of 4

Thread: Add a column for Switch Menu

  1. #1
    Join Date
    Nov 2005
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Add a column for Switch Menu

    I want to add a second column for the switch menu. Any ideas on how to do that?

    http://www.dynamicdrive.com/dynamici...switchmenu.htm

  2. #2
    Join Date
    Nov 2005
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    http://www.waterloo.lib.in.us/new_si...ence_links.htm

    Here is the page I want to modify. The first column works like a charm. The second column opens, but doesn't close when the next link is clicked. How can I fix that?

  3. #3
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    You seem to have 2 divs with the ID masterdiv. What JavaScript is doing is it's looking at only the first div to see if any are currently open, because ID's are unique and there is only suppose to be one unique ID per page.

    To fix this, change the second masterdiv to something like masterdiv2. You then need to change the SwitchMenu function to this:
    HTML Code:
    function SwitchMenu(obj){
    	if(document.getElementById){
    	var el = document.getElementById(obj);
    	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
    	var ar2 = document.getElementById("masterdiv2").getElementsByTagName("span");
    		if(el.style.display != "block"){ //DynamicDrive.com change
    			for (var i=0; i<ar.length; i++){
    				if (ar[i].className=="submenu") //DynamicDrive.com change
    				ar[i].style.display = "none";
    			}
    			for (var i=0; i<ar2.length; i++){
    				if (ar2[i].className=="submenu") //DynamicDrive.com change
    				ar2[i].style.display = "none";
    			}			
    			el.style.display = "block";
    		}else{
    			el.style.display = "none";
    		}
    	}
    }

  4. The Following User Says Thank You to techietim For This Useful Post:

    mb716 (07-03-2008)

  5. #4
    Join Date
    Nov 2005
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Awesome. Thanks so much!

Bookmarks

Posting Permissions

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