Posted By

1man on 07/06/06


Tagged

show navigation hide


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

luman
marza
kele5240


Show / Hide an unordered list


 / Published in: JavaScript
 

This script allows you to show and hide a at the click of a button. See Show / Hide HTML for Markup.

  1. function enableRightNavExpand() {
  2. if (!document.getElementById) return false;
  3. if (!document.getElementById("rightNav")) return false;
  4. var nav = document.getElementById("rightNav");
  5. var navItem = nav.getElementsByTagName("li");
  6. for (var i = 0; i < navItem.length; i++){
  7. navItem[i].onclick=function() {
  8. if (this.className == "selected") {
  9. this.className = "";
  10. }
  11. else if (this.className == ""){
  12. this.className = "selected";
  13. }
  14. }
  15. }
  16. }

Report this snippet  

You need to login to post a comment.