sugan Posted September 5, 2008 Share Posted September 5, 2008 Hi,I want to create a side menu in my page as NamesBirthdaysCountriesIf i click on names it should list likeNames Anu Banu CavinBirthdaysCountriesLike 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 More sharing options...
Kingy Posted September 5, 2008 Share Posted September 5, 2008 Is this what you're looking for?http://www.dynamicdrive.com/dynamicindex1/...inkvertical.htm Link to comment Share on other sites More sharing options...
sugan Posted September 6, 2008 Author Share Posted September 6, 2008 No, Not like that! I want like Names Anu Banu CavinBirthdaysCountriesI want it inside itself! Kindly tell me the way to do it...Regards,Suganya Link to comment Share on other sites More sharing options...
Ingolme Posted September 6, 2008 Share Posted September 6, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.