Next page | Contents page |

Some useful objects

Document Object Model (DOM) level 0

We mentioned on an earlier page that the DOM has progressed to level 3 at the time of writing. Here we consider the original level 0 version. Nowadays there are easier ways of doing things but this structure is still present.

Elements on an HTML page are represented by objects or arrays which can be accessed by the script. They are properties of an object called document, of class Document.

For example, if the page contains a hyperlink, written in HTML as <a name="abc" href="xyz">XYZ</a> then script can access this as document.links ["abc"] or as document.links [n] if this is the nth link in the page (counting from 0).

Some useful properties of the document object

Many of those are awkward to use because you would need to know the numbered sequence of objects on the page, so they are rarely used now. It is much simpler to use id attributes on elements you need to access, as we have been doing from the beginning of this course. This technique was not available in the original DOM, used by early browsers.

Objects other than document

window location navigator screen history

MORE COMING SOON (January 2018)

Next page | Contents page |