Element

本文深入探讨了DOM核心中的Element接口,包括属性、方法和DOM核心引用等内容。重点介绍了Element对象如何代表HTML或XML文档中的元素,以及如何通过属性和方法操作这些元素。

http://www.w3.org/wiki/DOM/domcore/Element

DOM/domcore/Element

DOM‎ | domcore

Element

The Element interface represents an element in an HTML or XML document. Elements may have attributes associated with them; since the Element interface inherits from Node, the generic Node interface attribute attributes may be used to retrieve the set of all attributes for an element.


Attributes

NameDescription
namespaceURI...
prefix...
localName...
tagNameReturns the name of the element.
attributes...
children...
firstElementChild...
lastElementChild...
previousElementSibling...
nextElementSibling...
childElementCount...


Methods

NameDescription
getAttribute(name)Retrieves an attribute value by name.
getAttributeNS(namespace, localName)Retrieves an attribute value by local name and namespace URI.
setAttribute(qualifiedName, value)Adds a new attribute.
setAttributeNS(namespace, qualifiedName, value)Adds a new attribute.
removeAttribute(qualifiedName)Removes an attribute by name.
removeAttributeNS(namespace, localName)Removes an attribute by local name and namespace URI.
hasAttribute(qualifiedName)Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
hasAttributeNS(namespace, localName)Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise.
getElementsByTagName(qualifiedName)Returns a list of all descendant Elements with a given tag name, in document order.
getElementsByTagNameNS(namespace, localName)Returns a list of all the descendant Elements with a given local name and namespace URI in document order.
getElementsByClassName(classNames)Returns the Element that has an class attribute with the given value.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值