O'Reilly logo

Programming Atlas by Christian Wenz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. DOM Reference

This Appendix assembles all DOM methods and properties that JavaScript exposes. 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 node to the element

appendData(data)

Appends data to a node, not overwriting 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

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()

Whether the element has subnodes or not

insertBefore(node)

Insert a node before the element

insertData(position, data)

Inserts data at a certain position

removeAttribute(attribute)

Removes the given attribute from the element

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required