課程
/前端開發
/JavaScript
/JavaScript進階篇
trs[i].onmouseout = function(){
this.style.backgroundColor ="#fff";
}?
2015-10-22
源自:JavaScript進階篇 9-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";
} ?
}
哪句話?第一個是表示最后一個子節點,第二個表示的是子節點數
兜里揣糖 提問者
心悅君夕 回復 兜里揣糖 提問者
舉報
本課程從如何插入JS代碼開始,帶您進入網頁動態交互世界
1 回答lastChild和childNodes的問題
4 回答為什么不用children而用childNodes[1]?
2 回答不太明白什么是lastChild
2 回答請教,firstchild和lastchild ,與childNodes[1]是不一樣的啊,為什么上面說是一樣的結果,我做錯了m?
1 回答為什么是“==”而不是“=”啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-10-24
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";
}?
} ?
}
2015-10-23
哪句話?第一個是表示最后一個子節點,第二個表示的是子節點數