課程
/前端開發(fā)
/JavaScript
/JavaScript進(jìn)階篇
document.createElement()的用法?appendChild() 或 insertBefore()的區(qū)別?
2015-10-23
源自:JavaScript進(jìn)階篇 7-20
正在回答
document.createElement()用戶創(chuàng)建元素。例如document.createElement("p")
appendChild()在body所有元素的最下方添加元素。
insertBefore() 方法在您指定的已有子節(jié)點(diǎn)之前插入新的子節(jié)點(diǎn),例如document.getElementById("myList").insertBefore(newItem,existingItem);
Alisa_0 提問者
哇塞!
Alisa_0 提問者 回復(fù) Alisa_0 提問者
舉報
本課程從如何插入JS代碼開始,帶您進(jìn)入網(wǎng)頁動態(tài)交互世界
3 回答document.createElement()
2 回答document.createElement是什么意思?
4 回答var newnode = document.createElement("li");???
4 回答本節(jié)的document.createElement("p")和otest是什么意思
1 回答setAttribute的用法
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-23
document.createElement()用戶創(chuàng)建元素。例如document.createElement("p")
appendChild()在body所有元素的最下方添加元素。
insertBefore() 方法在您指定的已有子節(jié)點(diǎn)之前插入新的子節(jié)點(diǎn),例如document.getElementById("myList").insertBefore(newItem,existingItem);
2015-10-23
哇塞!