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

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';

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

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?

06-11-2007, 06:09 PM
Here is a link to an example of one way you could do it:

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