猿问

id加不上~~alert没反应~~求大神帮忙看一下~~~

window.onload=function(){
        var titles=document.getElementById("month_tit").getElementsByTagName("li");
        var divs=document.getElementById("month_con").getElementsByTagName("div");
        if(titles.length!=divs.length)
                return;
        for(var i=0;i<titles.length;i++){
                titles[i].index=i;
                titles[i].onmouseover=function(){
                        for(var j=0;j<titles.length;j++){
                           titles[j].className="";
                           divs[j].style.display="none";
                        }
                        this.className="selected";
                        divs[this.id].style.display="block";
                }
        }
}


Hi_给我一个大甜筒
浏览 828回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答