Dom 简明教程
DOM - Attribute Object
Attr 接口表示 Element 对象中的一个属性。通常,属性允许的值在与文档关联的模式中定义。Attr 对象不被视为文档树的一部分,因为它们实际上并非其所描述元素的子节点。因此,对于子节点 parentNode、previousSibling 和 nextSibling,属性值为 null。
Attr interface represents an attribute in an Element object. Typically, the allowable values for the attribute are defined in a schema associated with the document. Attr objects are not considered as part of the document tree since they are not actually child nodes of the element they describe. Thus for the child nodes parentNode, previousSibling and nextSibling the attribute value is null.
Attributes
下表列出了 Attribute 对象的属性:
The following table lists the attributes of the Attribute object −
Attribute |
Type |
Description |
DOMString |
This gives the name of the attribute. |
|
boolean |
It is a boolean value which returns true if the attribute value exists in the document. |
|
DOMString |
Returns the value of the attribute. |
|
Element |
It gives the node to which attribute is associated or null if attribute is not in use. |
|
boolean |
It returns whether the attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. |