Subscribe
startList = function() {
if (document.all && document.getElementById) {
for (d = 1; d< 10; d++) { navroot=document.getElementById('menu'+d); for (i=0; inavroot.childnodes.length; i++) { node=navRoot.childNodes[i]; if (node.nodename="LI" ) { node.onmouseover=function() { this.classname+="over" ; if (d!=1) menu1.classname+="hide" ; } node.onmouseout=function() { this.classname=this.className.replace(" over" , ); menu1.classname=menu1.className.replace(" hide" , ); } } } } } } /code>
Those familiar with the sfhover javascript will notice the only difference in mine is for (d = 1; d< 10; d++) {/code> Of course, this only works in IE. What I need is something that works in all browsers and doesn't require adding any javascript anywhere in the body. What it should do is add a class called 'hide' to the LI in menu1 whenever the user mouses over menu2 and remove the class 'hide' from menu1 when the user mouses out. It has to work in IE6 , IE7, Firefox, and Safari. It has to not interfere with the dropdown script that is required since IE won't recognize :hover on elements other than anchors.
While I'm revealing the depths of ignorance, I'd really like to understand how to make this work. Thanks!
As a secondary, and far less important question, does anyone know where I can download IE6? I use Firefox and recently updated IE to 7 to mess around. I intended to install it alongside 6 so I could test layouts in both 6 and 7, but I seem to have uninstalled 6. Anyway. Back to the real question.>>
startList = function() {
if (document.all && document.getElementById) {
for (d = 1; d< 10; d++) {br>
navRoot = document.getElementById('menu'+d);
for (i=0; i
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+="over";
}
node.onmouseout=function() {
this.className=this.className.replace("over", "");
}
}
}
}
}
}
window.onload=startList;
>menu1.className+="hide", don't you need a space before the "hide?"this keyword differently, and it is not always safe to assume it points to the correct object when you use it in an event-handling function.You are not logged in, either login or create an account to post comments
startList = function() {
if (document.all && document.getElementById) {
for (d = 1; d< 10; d++) {br> navRoot = document.getElementById('menu'+d);
for (i=0; i
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+="over";
if (d!=1) menu1.className+="hide";
}
node.onmouseout=function() {
this.className=this.className.replace("over", "");
menu1.className=menu1.className.replace("hide", "");
}
}
}
}
}
}
window.onload=startList;
Those familiar with the sfhover javascript will notice the only difference in mine is for (d = 1; d< 10; d++) {/code> Of course, this only works in IE. What I need is something that works in all browsers and doesn't require adding any javascript anywhere in the body. What it should do is add a class called 'hide' to the LI in menu1 whenever the user mouses over menu2 and remove the class 'hide' from menu1 when the user mouses out. It has to work in IE6 , IE7, Firefox, and Safari. It has to not interfere with the dropdown script that is required since IE won't recognize :hover on elements other than anchors.
While I'm revealing the depths of ignorance, I'd really like to understand how to make this work. Thanks!>
posted by Grod at 8:00 PM on October 31, 2006