Events

The trick to calling functions is to use events to do the work for you. JavaScript is event-driven, which means everything that happens is the result of an event or causes some event to occur. Opening a new page in the browser window is an event. Moving the mouse pointer is an event. Clicking is an event. The four events you will use the most in this book are

  • onLoad

  • onClick

  • onMouseover

  • onMouseout

Let's run through each of these quickly so that you're familiar with them before we continue.

The onLoad Event

The onLoad event is the event that occurs when something has loaded—for example, the browser has finished loading a page into the browser window. This event occurs only when all of the page (including images if they are set to load) has ...

Get JavaScript™ 1.5 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.