为什么一定要加window.onload=function(){}才能实现变色呢?
window.onload = function(){
var tr=document.getElementsByTagName("tr");
for(var i=0;i<tr.length;i++){
tr[i].onmouseover=function(){this.style.backgroundColor='#f2f2f2';};
tr[i].onmouseout=function(){this.style.backgroundColor='#fff';};
}
}