关于事件绑定的,为什么注释处的代码能执行,没有注释的不能?
var bindColor = function(){
for(var i = 0; i < as.length; i++)
{
var tr = as[i].parentNode.parentNode;
// tr.onmouseover = function(){
// this.style.backgroundColor ="#f2f2f2";
// }
// tr.onmouseout = function(){
// this.style.backgroundColor ="#fff";
// }
addEvent(tr,"onmouseover",function(){
this.style.backgroundColor ="#f2f2f2";
})
addEvent(tr,"onmouseout",function(){
this.style.backgroundColor ="#fff";
})
}
}