JavaScript学习笔记之DOM

/ 0评 / 0

浏览器:

浏览器对象:

操作DOM:html文档被解析后是一棵DOM树

获取DOM节点:

更新DOM:

插入DOM:

var p = createElement("p");
p.id = "p1";
p.innerText = "段落";
list.append(p);
list.insertBefore(newElement, referenceElement);

删除DOM:

调用父节点的removeChild()。self.parentElement;