demosthenes.info

I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter.

featured articles

popular favourites

The JavaScript DOM

DOM (for Document Object Model) is a way of conceptualizing the contents of a web page. You can think of this as an agreed-upon way of describing elements in the document, just as there is an agreed-upon way of describing houses on your street in English. We all acknowledge, for instance, that the long strip of tarmac dividing houses on one side from the other is called the “road”. Each house is numbered, but we might also address them by position: “The third house on the left”, for example, or “The house after the red house”. While each house or building will be entered in a slightly different way, we call that entry by the same name: “door”.

In just the same way, the DOM allows us to describe the content of web pages. DOM Level 0, created in 1997, was a basic page description language, but it grew rapidly in complexity. Both Netscape and Microsoft created completely different and incompatible DOMs in order to compete with each other, forcing developers to code for one browser or another if they wanted to add JavaScript to their pages.

In 1998, the W3C released DOM Level 1, a standardized API for referring to the content of web pages, and modern graphical browsers now support it to a high degree. The DOM has now become so ubiquitous that the scripting we are about to look into has been given yet another term: DOM Scripting.

The DOM is strongly reliant on validated, structured, semantic HTML code. Just as you might struggle to make sense of a city that has grown without any plan, reason, or building codes, will have a very hard time working with a page that is invalid. For that reason, you should have a strong understanding of XHTML 1.0 Strict before attempting to add JavaScript to a page. Just like CSS, JavaScript loves clean code.

You must be signed up in order to leave comments.

web developer guide

featured comment

by Aisling Brock in New Business Card Design

what i'm reading

A Feast for Crows: A Song of Ice and Fire: Book Four
A Feast for Crows: A Song of Ice and Fire: Book Four

what i'm watching

Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]
Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]

what i'm playing

Borderlands
Borderlands

what i'm hearing

Planets
Planets

blogs

podcasts

no ads ever

This blog is free of advertising, and always will be.

creative commons licensed

The content of this blog is free to use in whatever way you wish under the Creative Commons license.