The DOM Hierachy

hierachy

Here is a simplified hierarchy of web page objects

The top most object window is usually optional when writing javascript.
For example,
window.document.bgColor='red' is the same as
document.bgColor='red'

In the rollover example we looked at earlier we used dom code document.images[0].src to access and change the image.
This was an example of using the DOM level 0.

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

In fact wherever there are several objects in the DOM they become part of an array

We can specify a particular image by using the DOM, starting at the document object.
document.images[0].src='image1.gif' is how we set the source, .src, of the first image on a page.
We count from zero so the first image is images[0].