Jump to content

Javascript Expandable Menu


jwenzel

Recommended Posts

I have this expandable javascript menu I made, but I've got a problem. When the page loads, all of the links are expanded. I can not for the life of me figure out how to have the links collapsed on load. Any help here would be great.Thanks,

<a href="java script:switchit('links')">Links</a><br /><li id="links">  <a href="link/">Link 1</a><br /><a href="link">LInk 2</a></li><script type="text/javascript">function switchit(list){var listElementStyle=document.getElementById(list).style;if (listElementStyle.display=="none"){listElementStyle.display="block";}else {listElementStyle.display="none";}}</script>

Link to comment
Share on other sites

You could style #links as display:none initially - just add #links { display:none; } to your CSS.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...