您现在的位置是:首页 > 电脑技术查询 > web开发

关于js兼容ie6的有关问题!

编辑:chaxungu时间:2022-10-02 23:15:15分类:web开发

请教高手关于js兼容ie6的问题!!!
哪位高手能帮忙指点下如何让下面的js兼容ie6浏览器呢?

JScript codestartList = function() {if (document.all&&document.getElementById) {navRoot = document.getElementById("navmall");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", "");}node.onmouseover=function() {this.className+="over";this.getElementsByTagName("a")[0].style.backgroundColor="#736767";this.getElementsByTagName("a")[0].style.color="#FFF";}node.onmouseout=function() {this.className=this.className.replace("over", "");this.getElementsByTagName("a")[0].style.backgroundColor="";this.getElementsByTagName("a")[0].style.color="";}}}}}window.onload=startList;

------解决方案--------------------
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];

不要用childNodes 用 getElementsByTagName