变色部分为什么要要使用for循环呢?
window.onload = function(){ var trs = document.getElementsByTagName('tr'); for(var i = 1; i < trs.length; i++){ trs[i].onmouseover = function(){ this.style.backgroundColor = "#f2f2f2"; } trs[i].onmouseout = function(){ this.style.backgroundColor = "#fff"; } } }
这个函数为什么要时候for循环遍历一次?