HTML DOM 方法

一、HTML DOM 方法可通过 JavaScript (以及其他编程语言)对 HTML DOM 进行访问。    

getElementById()

返回带有指定 ID 的元素。

getElementsByTagName()

返回包含带有指定标签名称的所有元素的节点列表(集合/节点数组)。

getElementsByClassName()

返回包含带有指定类名的所有元素的节点列表。

 

 

 

 

 

appendChild()

把新的子节点添加到指定节点。

removeChild()

删除子节点。

replaceChild()

替换子节点。

createAttribute()

创建属性节点。

createElement()

创建元素节点。

createTextNode()

创建文本节点。

猜你喜欢

转载自www.cnblogs.com/yachjin/p/8975503.html