Hierarchical Menus with the Underrated style.display Object
Subject:   Simplify hideAll()
Date:   2005-02-04 10:38:15
From:   slipjig
1/ Make all menu tables be of class "menu"
2/ Use a naming convention where the image has the same id as the menu table with 'Img' at the end
Example :

<img id="link2Img" src="minus.gif" width="11" height="11"> link 2
<tr><td><table class="menu" id="link2" border = "0">
<tr><td> First sub-menu item ...

hideAll() can then be "automated" so tht you don't have to remember to add a line to hideAll if you add a new menu item :

function hideAll() {
var tables = document.getElementsByTagName("table");
for (var i = 0; i < tables.length; i++) {
if (tables[i].className == "menu") {
var tid = tables[i].id

tomthecat can still have his "exept" if he wants.

Full Threads Oldest First

Showing messages 1 through 1 of 1.