The DOM Hierachy

hierachy

Here is a simplified hierarchy of web page objects or DOM.

The top most object window is usually optional when writing javascript.
For example,
window.alert('hello') is the same as
alert('hello')

In the image rollover example we looked at earlier we could have used the dom code
document.images[0].src instead of
this.src to access and change the image.

Wherever there are several similar objects in the DOM they become part of an array or list.

A document may have several images which form an array of images, called images[]

images[0] is the first image on a page.

We can locate a particular image by working down through the DOM, starting at the document object.
document.images[0] is the location in the dom of the image
document.images[0].src='image1.gif' sets the source, src, of the image location to the image itself, image1.gif.