求指点迷津,我的onload函数哪里写错了,得不到想要的结果 !!
求大神指点一下迷津,我写的错在哪里?
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"; }; } }