为什么此处只能用this,如果把this换成oLis就是错的?
<script type="text/javascript">
var oLi = document.getElementsByTagName("li");
for (var i = 0; i < oLi.length; i++) {
var oLis = oLi[i];
i % 2 === 0 ? (oLis.className = "c1" , oLis.old = "c1") : (oLis.className = "c2", oLis.old = "c2");
oLis.onmouseover = function () {
this.className = "c3"; //为什么此处只能用this,如果把this换成oLis就是错的?
};
oLis.onmouseout = function () {
this.className = this.old;
};
}
</script>