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