...

View Full Version : Menu, click new menu item, and close open menu item?



reyna12
06-11-2007, 05:00 PM
Current code is


function toggleMenu(objID) {
if (!document.getElementById) return;
var ob = document.getElementById(objID).style;
ob.display = (ob.display == 'block')?'none': 'block';
}



<ul>
<li onClick="toggleMenu('manufacturer8')"><a href="#">man 8</a></li>
</ul>
<div id="manufacturer8" class="mL">
<ul>
<li><a href="#">product</a></li>
</ul>
</div>

I would like it so when you click one of the menu items like man 8 the other open menu item like man 4 closes, at the moment you click them all and they all stay open and it scrolls down the page too much. Any ideas?

jryoung
06-11-2007, 06:09 PM
Here is a link to an example of one way you could do it:
http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm

reyna12
06-11-2007, 06:35 PM
Thanks, not an easier way just adding a bit of code, got lost trying to modify that code



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum