PDA

View Full Version : SwitchMenu - Collapse Menu Problem



The Warden
08-24-2005, 10:12 PM
Hi. I'm not sure what I've done wrong but as far as I can tell I think this maybe a bug. I implemented the SwitchMenu (http://www.dynamicdrive.com/dynamicindex1/switchmenu.htm). It works great however I've found that when a parent menu item/node is found to not have children menu items/nodes it breaks the rest of the menu downward. What this means is any parent menu item/node listed below this will no longer expand and stay expanded. The parent menu item/node just expands and then collapses right away.

Now yes I have replaced the span element tag with unordered list element tag and replaced list item element tags before and after each anchor tag. See my code snippet below. The JavaScript code has stayed in tact only changes that I did was changed reference to getElementById("leftnav") and getElementsByTagName("ul"). I've tried leaving everything as is without my modifications and I still seem to experience this problem.

Anyone have any idea what I maybe doing wrong or how to resolve this?

<div id="leftnav">
<div class="menutitle"><a href="">Homepage</a></div>
<div class="menutitle" onclick="SwitchMenu('sub2')"><a href="">News & Policies</a></div>
<ul class="submenu" id="sub2">
<li><a href="" title="">Announcements</a></li>
<li><a href="" title="">Rep Council</a></li>
<li><a href="" title="">Policies & Procedure</a></li>
<li><a href="" title="">Industry News</a></li>
<li><a href="" title="">Venmar CES is ARI Cetified</a></li>
<li><a href="" title="">Newsletter Archive</a></li>
</ul>
<div class="menutitle"><a href="">Products</a></div>
</div>