Jump to content

menu bar


sugan

Recommended Posts

Hi,I want to create a side menu in my page as

NamesBirthdaysCountries
If i click on names it should list like
Names Anu Banu CavinBirthdaysCountries
Like this it should work for everything. If i click countries, the names should be collapsed and countries should be expanded.How to do it?Regards,Suganya
Link to comment
Share on other sites

Just change the visibility of the objects inside the <li> element.Here's the HTML and Javascript for it. You can style the list with CSS later.HTML:

<ul id="menu">  <li><a href="java script: void(0);" onclick="toggle(this.parentNode)">Names</a>	<ul>	  <li>Anu</li>	  <li>Banu</li>	  <li>Cavin</li>	</ul>  </li>  <li>Birthdays</li>  <li>Countries</li></ul>

Javascript:

function toggle(me) {(me.getElementsByTagName("ul")[0].style.display == "block")?me.getElementsByTagName("ul")[0].style.display == "none":me.getElementsByTagName("ul")[0].style.display == "block";}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...