? ? for(var i=0,l=as.length;i<l;i++){? ? ? ? as[i].onmouseover=function(){? ? ? ? ? reset();? ? ? ? ? this.style.background='#ccf';? ? ? ? ? index=this.getAttribute('selectid')-1;? ? ? ? ? //index=i;為什么這樣不行??????????? ? ? ? }}為什么不能直接用i給index賦值,而是要通過(guò)別的與i無(wú)關(guān)的方式賦值(前提index=this.getAttribute('selectid')-1和index=i在邏輯上是值是一樣的)
關(guān)于for循環(huán)中i的用法
棲息在月亮上的麻雀
2016-04-06 10:27:21