Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-11-2007, 04:00 PM   PM User | #1
reyna12
New Coder

 
Join Date: Jan 2006
Posts: 88
Thanks: 4
Thanked 1 Time in 1 Post
reyna12 is an unknown quantity at this point
Menu, click new menu item, and close open menu item?

Current code is

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

Code:
<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?
reyna12 is offline   Reply With Quote
Old 06-11-2007, 05:09 PM   PM User | #2
jryoung
New Coder

 
Join Date: Sep 2006
Posts: 32
Thanks: 0
Thanked 3 Times in 3 Posts
jryoung is an unknown quantity at this point
Here is a link to an example of one way you could do it:
http://www.dynamicdrive.com/dynamici...switchmenu.htm
jryoung is offline   Reply With Quote
Old 06-11-2007, 05:35 PM   PM User | #3
reyna12
New Coder

 
Join Date: Jan 2006
Posts: 88
Thanks: 4
Thanked 1 Time in 1 Post
reyna12 is an unknown quantity at this point
Thanks, not an easier way just adding a bit of code, got lost trying to modify that code
reyna12 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:28 AM.


Advertisement
Log in to turn off these ads.