window.onload = function(){
var tr=document.getElementsByTagName("tr");
for(var i= 0;i<tr.length;i++)
{
tr[i].onmouseover=function(){
tr[i].style.backgroundColor="#f2f2f2";
}
tr[i].onmouseout=function(){
tr[i].style.backgroundColor="#fff";
}
}
望采纳。。谢谢
楼上回答的非常正确