Javascript: DOM 3

Let's look at the following code in detail. In the HTML we have:

<body onload="setColorRed()">

The "onload" is an event. Javascript gives us the ability to react to events such as the loading of an element, the pressing down of a mouse, hovering over a particular element, etc.

In this case we are telling the Javascript engine to execute a particular function when the body element has been loaded.