JavaScript Reference :: Node

The easiest way to create a Node object is to get a reference to an HTML element using either the document method getElementById or getElementsByTagName. Of course, you may also use createElement method. Once you have the element, you can assign event handlers or modify the properties.

methods

void appendChild(Node)
Appends a node to the node.
Node cloneNode()
Returns a copy of the node.
boolean contains(Node)
Returns true if the node specified is a child of the Node object.
string getAttribute(string)
Returns the value of the attribute for the specified attribute name.
insertBefore(Node, Node)
Inserts the node specified in the first argument into the childNodes array before the node specified in the second argument.
void removeChild(Node)
Removes the specified child node from the node.

properties

action
childNodes
A NodeList of nodes that are contained by the node.
className
A string representing the class of the node.
firstChild
The Node that is the first child of the node object.
hasChildNodes
A boolean that is true when the node contains children.
id
The id of the node.
innerHTML
The HTML inside the node, for example the innerHTML of <a href="http://myurl.com">my URL</a> is "my URL".
innerText
The text within the node. This is similar to the innerHTML property.
lastChild
The Node that is the last child of the node object.
nextSibling
The Node that is next child in the parent node stack.
nodeType
The XML node type.
parentNode
The Node object that is the parent of the node.
previousSibling
The Node that is the previous child in the parent node stack.
tagName
The HTML or XML tag used to generate the node.

events