刚看了个例子,有个地方没懂~代码如下
<script type="text/javascript">
var oList=document.getElementById("list");
var oLis=oList.getElementsByTagName("li");
for(var i=0;i<oLis.length;i++){
var oLi=oLis[i];
(i%2===0)?(oLi.className="a1",oLi.play="a1"):(oLi.className="a2",oLi.play="a2");
oLi.onmouseover=function () {
this.className="a3";
}
oLi.onmouseout=function(){
var oldVal=this.play;
this.className=oldVal;
//为什么不能写成 this.className=oLi.play?
}
}
</script>
相关分类