为什么只有第三行是颜色发生变化的呢?
window.onload = function(){
var tr=document.getElementsByTagName("tr");
for(i=0;i<tr.length;i++){
tr[i].onmouseenter=function(){tr[i].style.background="#f2f2f2";}
tr[i].onmouseleave=function(){tr[i].style.background="#fff";}
}
}
window.onload = function(){
var tr=document.getElementsByTagName("tr");
for(i=0;i<tr.length;i++){
tr[i].onmouseenter=function(){tr[i].style.background="#f2f2f2";}
tr[i].onmouseleave=function(){tr[i].style.background="#fff";}
}
}
2018-01-23
举报