Appendix C. DOM Reference

This Appendix assembles all DOM methods and properties exposed by JavaScript. The DOM used is the W3C DOM supported by recent versions of Internet Explorer, Mozilla, Safari/Konqueror, and Opera. Methods and properties that are not supported by either of the two “main” browsers—Internet Explorer and Mozilla brands—are not mentioned.

Square brackets [] denote an array; parentheses ( ) indicate a method.

Generic Methods and Properties

The methods and properties in this section exist for all DOM elements.

Methods

Method

Description

appendChild(node)

Appends a child node to the element

appendData(data)

Appends data (HTML or text) to a node; does not overwrite existing data

blur( )

Removes the focus from the element

click( )

Simulates a click on the element

cloneNode(deep)

Creates a copy of the node (if deep is true, all subnodes are copied as well)

deleteData(start, length)

Deletes a number of characters from the data in a node

focus( )

Gives the focus to the element

getAttribute(attribute)

Returns the value of the given attribute

getAttributeNode(attribute)

Returns the node containing the given attribute

getElementsByTagName(name)

Returns an array of all elements with the given tag name

hasChildNodes( )

Returns a value that indicates whether the element has subnodes

insertBefore(node)

Inserts a node before the element

insertData(position, data)

Inserts data (HTML or text) at a certain position

removeAttribute(attribute)

Removes the given attribute and its value from the element

removeChild(node) ...

Get Programming ASP.NET AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.