Guest FirefoxRocks Posted November 24, 2007 Share Posted November 24, 2007 Ok I decided to make a navigation menu that expands because the person I'm working with doesn't like the flyouts that took me hours to make.The preview can be seen here: http://portal.trap17.com/dhstemp/.Right now when you click on the section/sub-section headers (h3 and h4) you show a menu that is otherwise hidden, or "not displayed". If you click on Sports, and then something under that, you will see that they expand multiple levels.There is also a hide button, or rather text, that is within the menu container that has an onclick event to hide the container.I want to get rid of it so that the header things can show the menu when not displayed and hide it when displayed. Is it possible to do this? I find that the hide text floats improperly in Internet Explorer 6 and takes up unnecessary space.Take a look at the source code if need be, all actions are specified within the onclick event attribute. Link to comment Share on other sites More sharing options...
Ingolme Posted November 24, 2007 Share Posted November 24, 2007 Well, instead of:onclick="document.getElementById('departments').style.display='block'"try:onclick="toggleNodes('departments')"And put this in the <head> of the page: <script type="text/javascript">function toggleNodes(obj) { if(document.getElementById(obj).style.display == "block") { document.getElementById(obj).style.display == "none" } else { document.getElementById(obj).style.display == "block" }}</script> Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted November 25, 2007 Share Posted November 25, 2007 That didn't work. Link to comment Share on other sites More sharing options...
Synook Posted November 25, 2007 Share Posted November 25, 2007 Try <script type="text/javascript">function toggleNodes(obj) { if(document.getElementById(obj).style.display == "block") document.getElementById(obj).style.display = "none"; else document.getElementById(obj).style.display = "block";}</script> Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted November 26, 2007 Share Posted November 26, 2007 That worked perfectly! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.