为什么是lastChild而不是childNodes
trs[i].onmouseout = function(){
this.style.backgroundColor ="#fff";
}
trs[i].onmouseout = function(){
this.style.backgroundColor ="#fff";
}
2015-10-22
function Highlight(){
var tbody = document.getElementById('table').lastChild;//这一行,为什么是lastChild,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";
}
}
}
举报