Jump to content
Sign in to follow this  
sugan

menu bar

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

Share this post


Link to post
Share on other sites

No, Not like that! I want like

Names Anu Banu CavinBirthdaysCountries
I want it inside itself! Kindly tell me the way to do it...Regards,Suganya

Share this post


Link to post
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";}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...