JavaScript tutorial - DOM objects and methods

Navigation

Skip navigation.

Site search

Site navigation

JavaScript tutorial

Printing

Other tutorials

DOM objects and methods

This gives all properties, collections and methods of the W3C DOM that can be reliably used in all major DOM browsers, as well as document.styleSheets, which is much less reliable, but useful if it is available.

Contents

Key

Each can be clicked for more information.

Collections will also have the length property, giving the number of entries in that collection.

The document node

Creating nodes

To walk the DOM tree

DOM support

All nodes

To walk the DOM tree

Attaching, copying or removing nodes

Node information

Element node attributes

Element node style

Element node size and position (not standardised)

Table and associated nodes

In addition to the normal node functionality, nodes belonging to tables have extra functionality, specially designed to work with the layouts of tables. All elements have their standard HTML attributes available as properties (using the same casing pattern as style properties).

To walk the DOM tree

Attaching, copying or removing nodes

Node information

Stylesheets (if supported)

Events

Adding and removing event listeners

Note that although the methods are attached to all nodes, browsers will only be able to detect events on element nodes, the document node, and the window object.

Creating event objects

Preparing event objects

Firing events

Additional event object methods and properties

As well as the traditional event object properties, some more are provided by DOM events (or IE events) capable browsers.

Last modified: 1 April 2011

  1. Previous
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.