About JavaScript

What Is JavaScript?

Where Do I Put JavaScript?

The Document Object Model

Javascript is designed to interact with the web page that contains it. For this reason, a fair chunk of Javascript is devoted to the Document Object Model (DOM). This is a set of data structures that represent the web page being viewed and its various components.

Javascript automatically has access to an object called "document". This is the data structure representing the current web page. Any elements and attributes in the document are represented as "descendants" of the document (represented by a dot, a name, a dot, a name, etc). For example:

document.head The head element of the document.
document.title The title of the document.
document.body The body element of the document.
document.body.bgColor The background colour of the body.
document.images The collection of all images in the document.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License