为甚用this不能用tr[i],我的理解是this和tr[i]是同一个对象
// 鼠标移动改变背景,可以通过给每行绑定鼠标移上事件和鼠标移除事件来改变所在行背景色。
var tr = document.getElementById("table").getElementsByTagName('tr');
for(var i=0; i<tr.length; i++)
{
tr[i].onmouseover = function(){
// tr[i].style.backgroundColor = "red";
this.style.backgroundColor = "red";
}
tr[i].onmouseout = function(){
tr[i].style.backgroundColor="white";
// this.style.backgroundColor="white";
}
}
}