Forum Moderators: open
[webmasterworld.com...]
This is where i was told to change from id to class.
cheers
<SCRIPT LANGUAGE="javascript">
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("dmenu");
for (i=0; i < navRoot.childNodes.length; 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;
//-->
</SCRIPT>
Make cached values.
instead of
for (i=0; i < navRoot.childNodes.length; i++)
better :
var nodesNumber = navRoot.childNodes.length;
for (var i=0; i < nodesNumber; i++)
Hope this helps to create one more cool service ;)
p.s. try and let me know whether it works. i have not tested actually
The only thing I have not realized is : what the need forif(document.all&&document.getElementById) condition?
i'd use document.getElementById only. Or you want this not to work in ffox?
The reason it checks for document.all is this script is only needed in IE. This script basically allows IE to fake the css hover method on other elements besides anchors, so it is not required in browsers where the hover method works on all elements.