Document object model (DOM)

Overview
In order for a computer to understand a document, it needs to follow a pre-defined structure built up of identifiable objects (document objects).

On a computer the term document is used to represent many file types, indeed we use folders to arrange computer documents (files?) including Word-processing (from MS-Word or Open Office), Spreadsheets, to databases and multimedia files (such as images, sounds and videos).

Kantor (2006) identified 3 aspects that define a document:


 * content
 * structure, and
 * style.

Not all documents will contain all three, for example a file containing a list of names and addresses to be used by another computer could have no style information. However, any document to be used for human interaction or display will have all three.

Document tree
The DOM can be thought of as a tree diagram constructed from the tags in an HTML page. So a simple DOM for a web page is:

Javascript - can access by navigating through the document tree but easier to use getElementByID and provide the elements with an id attribute.