为什么我用以下办法不行呢?
var trs = document.getElementsByTagName("tr");
window.onload = function(){
for(var i=1; i<trs.length; i++){
trs[i].setAttribute(onmouseover,"onMover("+i+")");
trs[i].setAttribute(onmouseout,"onMout("+i+")");
}
}
function onmover(n){
trs[n].style.backgroundColor= "#f2f2f2";
}
function onMout(n){
trs[n].style.backgroundColor="#fff";
}