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