这段代码没太理解,求指教!
1 2 3 4 5 6 7 8 9 10 | function Highlight(){ var tbody = document.getElementById( 'table' ).lastChild; //table节点的最后一个子节点不是最后一个tr节点嘛?怎么成数组了? 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" ; } } |
table节点的最后一个子节点不是最后一个tr节点嘛?怎么成数组了?
table节点的最后一个子节点不是最后的tr节点嘛?怎么成数组了?for循环里面的语句是什么意思呢?