为什么这样写背景没有变化
window.onload = function(){
var x=document.getElementsByTagName("tr");
for(i=0;i<x.length;i++){
x[i].onmouseover=function(){
x[i].style.backgroundColor="#f2f2f2"
};
x[i].onmouseout=function(){
x[i].style.backgroundColor="#fff"
};
}
}
window.onload = function(){
var x=document.getElementsByTagName("tr");
for(i=0;i<x.length;i++){
x[i].onmouseover=function(){
x[i].style.backgroundColor="#f2f2f2"
};
x[i].onmouseout=function(){
x[i].style.backgroundColor="#fff"
};
}
}
2016-10-04
举报