首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

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

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

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

JScript code
startList = 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

热点排行
Bad Request.