Handling Events

As mentioned in Hour 1, “Understanding JavaScript,” not all scripts are located within <script> tags. You can also use scripts as event handlers. While this might sound like a complex programming term, it actually means exactly what it says: Event handlers are scripts that handle events.

In real life, an event is something that happens to you. For example, the things you write on your calendar are events: “Dentist appointment” or “Fred's Birthday.” You also encounter unscheduled events in your life: for example, a traffic ticket, an IRS audit, or an unexpected visit from relatives.