Constructors
| Constructor | Action | IE | Mozilla | Netscape | Opera | Safari | Chrome | ||
|---|---|---|---|---|---|---|---|---|---|
|
Attr Constructor() : Attr
Represents the attributes of an Element object.
|
Show Details | ||||||||
Attr() : AttrRepresents the attributes of an Element object. Returns
|
|||||||||
Properties
| Property | Action | IE | Mozilla | Netscape | Opera | Safari | Chrome |
|---|---|---|---|---|---|---|---|
|
name
: String
Name of the attribute object.
|
Show Details | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
|
|||||||
|
ownerElement
: Element
Parent node that the attribute is attached to.
|
Show Details | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
|
|||||||
|
specified
: Boolean
If true, specifies that the attribute was explicitly created.
|
Show Details | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
|
|||||||
|
value
: String
Value of the attribute.
|
Show Details | 4.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+ | no |
|
|||||||
Remarks
Attributes are properties of Elements and do not have their own identities. Although an Attr is a descendant
of a Node, an Attr is not placed in a parentNode, nextSibling or previousSibling,
and its own instances of those properties are null. Additionally, an Attr objects may only be a
child of an Element object.
Set the value of an attribute either via the DOM, from a source document, or from a DTD or other XML Schema.
If a declaration for an attribute exists that defines a default value, and the attribute in question does not exist, the attribute
will be automatically added with the given value. Usually, however, an attribute does not exist until it is explicitly added.
References
Availability
HTML DOM Level 2|W3C