DOM level 2 Attributes | |||
---|---|---|---|
![]() ![]() ![]() |
|||
Attribute | General syntax and example | Description and/or explanation | Support |
attributes | x.attributes.item(1) x.attributes["align"] |
Returns in a NamedNodeMap object a collection of all possible attributes of node x in no particular order. Returns the 2nd attribute object of node x. Returns the attribute node align from node x. | ![]() ![]() ![]() |
caption | x.caption |
Gets the caption object of node x which must be a table element. | ![]() ![]() ![]() |
cells | x.cells | Returns an HTMLCollection of all <td> nodes of node x which must be a table row | ![]() ![]() ![]() |
cellIndex | x.cellIndex | Returns the index (in the row) of node x which must be a <td> or a <th> The index of this cell in the row, starting from 0. This index is in document tree order and not display order. | ![]() ![]() ![]() |
cellPadding | x.cellPadding x.cellPadding = "6" |
Gets or sets the cellpadding attribute of a node which must be a table. | ![]() ![]() ![]() |
cellSpacing | x.cellSpacing x.cellSpacing = "6" |
Gets or sets the cellspacing attribute of a node which must be a table. The rules attribute must not be defined and border-collapse:separate must be the actual declaration | ![]() ![]() ![]() |
childNodes | x.childNodes[4] | Returns a NodeList object that contains all children of such node. Returns the 5th node of node x. | ![]() ![]() ![]() |
className | x.className x.className="newClassName" |
Gets or sets the class attribute of element x. | ![]() ![]() ![]() |
data | x.data x.data="new text" |
Gets or set the character data of node x that implements the CharacterData interface. Equivalent to nodeValue only if the node is of type TEXT_NODE | ![]() ![]() ![]() |
documentElement | x = document.documentElement.scrollHeight | This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML". | ![]() ![]() ![]() |
doctype | document.doctype.systemId | The Document Type Declaration (DTD) associated with a document. The doctype declaration is in the prologue of the document. | ![]() ![]() |
firstChild | x.firstChild | The first child of node x. | ![]() ![]() ![]() |
frame | x.frame x.frame = "above" |
Gets or sets the external table borders to render. Possible values: void, box, border, above, below, hsides (horizontal sides), lhs (left hand side), rhs (right hand side), vsides (vertical sides). | ![]() ![]() ![]() |
id | x.id x.id="newIdValue" |
Gets or set the id attribute value of the HTML element | ![]() ![]() ![]() |
implementation | document.implementation | The DOMImplementation object that handles the document | ![]() ![]() ![]() |
lastChild | x.lastChild | The last child of node x. | ![]() ![]() ![]() |
name | x.name | Gets or sets the name value attribute of node x. | ![]() ![]() ![]() |
nextSibling | x.nextSibling | The node immediately following node x | ![]() ![]() ![]() |
nodeName | x.nodeName | The name of node x, depending on its type. If node x is of type TEXT_NODE, then the nodeName returns #text otherwise it returns the name of the HTML element or the name of the attribute. | ![]() ![]() ![]() |
nodeType | x.nodeType | 1 is an HTML element 2 is an attribute 3 is a text node One convenient way to avoid memorizing these numbers is to use constants such as ELEMENT_NODE, ATTRIBUTE_NODE and TEXT_NODE. Only Mozilla supports these constants. |
![]() ![]() ![]() |
nodeValue | x.nodeValue x.nodeValue x.nodeValue = "New value" |
Gets or sets the value of node x, depending on its type | ![]() ![]() ![]() |
offsetParent | x.offsetParent | The offsetParent is the parent node acting as the positioning parent of node x. Often it is the closest (in the document hierarchy) absolutely positioned containing block of a node. This is a DHTML object model property and is very useful for defining offsetLeft, offsetTop DHTML properties of elements. | ![]() ![]() ![]() |
ownerDocument | x.ownerDocument | The Document object associated with node x. This is also the Document object used to create new nodes. | ![]() ![]() ![]() |