next up previous
Next: Objects in JavaScript Up: JavaScript: Formal Syntax Previous: Some Useful JavaScript Functions

Events

JavaScript is an event-driven system:

What is an Event?

JavaScript Events:

Event Description
blur Input focus is moved from the object.
  Usually when moving from a field of a form
  or from the form itself.
change Value of a field in a form has been
  changed by the user entering
  or deleting data.
click Mouse is clicked over an
  element of a page.
focus Input focus is given to an element.
  The reverse of blur.
load Page is loaded by the browser.
mouseover Mouse pointer is moved over an element.
select A field on a form is selected by clicking
  the mouse or tabbing from the keyboard.
submit When a form is submitted
  (the submit button is clicked).
unload User leaves the Web page.

JavaScript Event Handlers

The processing associated with an event is managed by an event handler. The list of event handlers is:

As we have already seen:

These are associated with an HTML element as part of its definition in the HTML source code:

<element attributes event ="handler ">

The handler will be a JavaScript function that you've defined elsewhere and which is available to the element.

For Example:

<body onLoad="init()">


next up previous
Next: Objects in JavaScript Up: JavaScript: Formal Syntax Previous: Some Useful JavaScript Functions
Dave Marshall
9/28/2001