Hey,
I am installing a vertical drop down menu on my website and everything is working perfect except for one little bug. I have about 12 links on my bar, two of them have children. When I load the page, the two sections with children are in a open state, which is not what I want. I want them to be closed on loading.
The odd part is, as soon as my mouse touches the menu, they instantly go to a closed state and then they work perfectly.
Here is my JS code.
[CODE]<script type=”text/javascript”>
<!–
window.onload=show;
function show(id) {
var d = document.getElementById(id);
for (var i = 1; i<=10; i++) {
if (document.getElementById(‘smenu’+i)) {document.getElementById(‘smenu’+i).style.display=’none’;}
}
if (d) {d.style.display=’block’;}
}
//–>
</script>
And here is my HTML code
[CODE] <dl id=”menu”>
<dt onclick=”javascript:show();”><a href=”index.html” class=”navigation_text”>Home</a></dt>
<dt onclick=”javascript:show();”><a href=”aboutus.html” class=”navigation_text”>About US</a></dt>
<dt onclick=”javascript:show(‘smenu2’);”><font class=”navigation_text”>Consulting</dt></font>
<dd id=”smenu2″>
<ul>
<li><a href=”operations.html” class=”navigation_text”>Operational</a></li>
<li><a href=”safety.html” class=”navigation_text”>Safety</a></li>
<li><a href=”internal.html” class=”navigation_text”>Internal</a></li>
</ul>
</dd>
<dt onclick=”javascript:show(‘smenu3’);”><font class=”navigation_text”>Driver Recruitment and Training</font></dt>
<dd id=”smenu3″>
<ul>
<li><a href=”premium.html” class=”navigation_text”>Premium</a></li>
<li><a href=”elite.html” class=”navigation_text”>Elite</a></li>
<li><a href=”standard.html” class=”navigation_text”>Standard</a></li>
</ul>
</dd>
<dt onclick=”javascript:show();”><a href=”dotsafe.html” class=”navigation_text”>DOT / Safety Compliance </a></dt>
<dt onclick=”javascript:show();”><a href=”fuel_mileage_tax.html” class=”navigation_text”>Fuel / Mileage Tax Service </a></dt>
<dt onclick=”javascript:show();”><a href=”licensing_permits.html” class=”navigation_text”>Licensing and Permits </a></dt>
<dt onclick=”javascript:show();”><a href=”traffictix.html” class=”navigation_text”>Traffic Tickets </a></dt>
<dt onclick=”javascript:show();”><a href=”drivers_wanted.html” class=”navigation_text”>Drivers Wanted </a></dt>
<dt onclick=”javascript:show();”><a href=”contact.html” class=”navigation_text”>Contact Us </a></dt>
<dt onclick=”javascript:show();”><a href=”sitemap.html” class=”navigation_text”>Site Map </a></dt>
</dl>