The event may be triggered by the action of a user, such as with the clicking of a mouse button, or triggered by the browser in response to a system level occurrence. When an event occurs, JavaScript will attempt to locate and execute a defined Event Handler. An Event Handler is a set of JavaScript statements that the scripting engine will execute when an associated event occurs. If an Event Handler is not defined for a particular event, then no action is taken at the time of the event. A list of JavaScript events can be found in the text at page 70.
Events are very useful in dealing with input from graphical user interfaces like an HTML page.
Like variables, events have a scope in which they can occur. In the case of JavaScript, events are scoped by the HTML tags to which they apply. The statements executed in response to the event are defined as an attribute to the tag to which they apply. Event handler attributes are named after the event to which they respond. The prefix on is added to the event name.