JS报错:Uncaught TypeError: Cannot read property 'style' of undefined

window.onload=function(){

        "use strict";

        a();b();

};

function a(){

             "use strict";

             var aLi=document.getElementsByClassName("main_list_li");

             var oRank=document.getElementsByClassName("rank");

             var oChange=document.getElementsByClassName("change");

             for(var i=0; i<aLi.length; i++){

               aLi[i].index=i;

           aLi[i].onmouseover=function(){

             this.style.backgroundColor="#f5f5f5";

             oChange[i].style.display="block";

             oRank[i].style.display="none";

             };

                 aLi[i].onmouseout=function(){

                 this.style.backgroundColor="#ffffff";

                oChange[i].style.display="none";

                 oRank[i].style.display="block";

                 };

                }

第15行报错  Cannot read property 'style' of undefined

云端有锋
浏览 1787回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript