W3C DOM Programming

With the move towards a standard Document Object Model, DOM, we can use javascript to do things that were previously impossible.

The ability exists to dynamically change the content of a page on the fly.

With these techniques can write Web Applications.

The Millionaire Quiz and Battlestar Quiz are both examples of what can be done using the new DOM programing techniques.

In addition, these powerful techniques apply not just to xhtml web pages but to any xml based document

To be able to manipulate the DOM you need to understand how the browser stores the DOM.

You probably think of a web page in two ways

In fact the browser internally represents it in a third way, as a Tree structure.

Lets look at a example

A web page as a set of tags and text

<html>
<head><title>Sample Document</title></head>
<body><h1>An Html Document</h1>
<p>This is a <i>simple</i> document</p>
</body></html>

The same web page as a Tree structure
domtree