Hi Mike, thanks for the response.
If possible I'd like something that's adaptable to different situations, that would work regardless of the number of levels of sub menus.
I had been using the following code, which does that. But it doesn't take into account keyboard navigation, so I tried adding functions for onfocus/onblur by copying the existing onmouseover/onmouseout functions. Onblur didn't hide the submenus again though (Am I misunderstanding what onblur does, or was I doing something wrong?) So I tried a different approach and was hoping I could put it all together into one. I got as far as the first code I posted and got stuck:
Code:
function hideSubMenus() {
var el=document.getElementById("menu").getElementsByTagName("li");
for (i=0; i<el.length; i++) {
el[i].className = "hide";
el[i].onmouseover = function() {
this.className = "show";
}
el[i].onmouseout = function() {
this.className = "hide";
}
}
}
Bookmarks