]|V|[agnus
10-07-2004, 06:44 AM
http://sethrasmussen.com/lyndale/dandelion/
In the sidebar, I've got submenus that are contained within nested <dl>s. These <dl>s are marked with the class "submenu".
I have this code to loop over all <dl>s, grab the ones with the appropriate class, and hide their <dd> offspring when the page loads:
function initSidebarSubs() {
var dls = document.getElementsByTagName("dl");
for (i=0;i<dls.length;i++) {
if (dls[i].className=="submenu") {
var kids = dls[i].childNodes;
for (i=0;i<kids.length;i++) {
if (kids[i].nodeName=="DD") {
kids[i].style.display = "none";
}
}
}
}
}
It works for the first <dl class="submenu"> on the page, but not the second one. :confused:
***
This is quite another issue entirely, but I am also trying to figure out how to do the main navigation submenus without inline event handlers, but I am not groking the other methods for doing such a thing for some reason. Can anybody point me to some good resources? Perhaps an example of what I'm trying to accomplish?
In the sidebar, I've got submenus that are contained within nested <dl>s. These <dl>s are marked with the class "submenu".
I have this code to loop over all <dl>s, grab the ones with the appropriate class, and hide their <dd> offspring when the page loads:
function initSidebarSubs() {
var dls = document.getElementsByTagName("dl");
for (i=0;i<dls.length;i++) {
if (dls[i].className=="submenu") {
var kids = dls[i].childNodes;
for (i=0;i<kids.length;i++) {
if (kids[i].nodeName=="DD") {
kids[i].style.display = "none";
}
}
}
}
}
It works for the first <dl class="submenu"> on the page, but not the second one. :confused:
***
This is quite another issue entirely, but I am also trying to figure out how to do the main navigation submenus without inline event handlers, but I am not groking the other methods for doing such a thing for some reason. Can anybody point me to some good resources? Perhaps an example of what I'm trying to accomplish?