JavaScript Element(元素)

来源:互联网 发布:合肥瑶海公园知乎 编辑:程序博客网 时间:2024/05/22 18:15

Element继承了Node类,也就是说Element是Node多种类型中的一种,即当NodeType为1时Node即为Element Node.


Element对象的方法如下表:


方法描述DOMgetAttribute()返回指定的属性值1getAttributeNS()返回指定的属性值,指定的名称空间。对于XML DOM2getAttributeNode()返回指定的属性节点1getAttributeNodeNS()返回指定的属性节点,指定的名称空间。对于XML DOM3getElementsByTagName()返回一个集合的所有子元素指定的标记名1getElementsByTagNameNS()返回一个集合的所有子元素指定的标记名和命名空间。对于XML DOM2hasAttribute()返回true,如果该元素具有指定的属性,否则返回false2hasAttributeNS(),则返回true,如果该元素具有指定的属性,指定的命名空间,否则返回false。对于XML DOM2removeAttribute()删除指定的属性1removeAttributeNS()删除具有指定名称和命名空间的属性。对于XML DOM2removeAttributeNode()删除指定的属性节点,并返回被移除的节点1setAttribute()设置或更改指定的属性,为指定的值1setAttributeNS()设置或更改指定的属性,指定的命名空间,为指定的值。对于XML DOM2setAttributeNode()设置或更改指定的属性节点1setAttributeNodeNS()设置或更改指定的属性节点2


原创粉丝点击