循环为什么是从1开始而不是0?
function Highlight(){
var tbody = document.getElementById('table').lastChild;
trs = tbody.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";
}
}
}循环为什么是从1开始而不是0?
还有就是函数体内为什么要有这行代码?
var tbody = document.getElementById('table').lastChild;