window.onload = function(){
// 鼠标移动改变背景,可以通过给每行绑定鼠标移上事件和鼠标移除事件来改变所在行背景色。
var tr = document.getElementsByTagName('tr')
for(var i = 1; i < tr.length; i++){
tr[i].onmouseover = function(){
obj.style.backgroundColor = 'lightgray'
}
tr[i].onmouseout = function(){
obj.style.backgroundColor = 'white'
}
}
}把obj改成this试一下 你的obj既不是参数也不是变量
有效果啊,你再试试