Event Handling

Here is the source code for a simple web form containing some Javascript that:

Events are things the user does.

Most of your Javascript programming will serve to handle events.

Javascript can detect a variety of events:

  • onAbort
  • onBlur
  • onChange
  • onClick
  • onDblClick
  • onDragDrop
  • onError
  • onFocus
  • onKeyDown
  • onKeyPress
  • onKeyUp
  • onLoad
  • onMouseDown
  • onMouseMove
  • onMouseOut
  • onMouseOver
  • onMouseUp
  • onMove
  • onReset
  • onResize
  • onSelect
  • onSubmit
  • onUnload
chap1.jpg (8222 bytes)

Lab

Your task:


Solution

Don't peek unless you're stuck!


Extra for Experts

Here's a web page with some Javascript that handles another kind of event: onKeyDown.

Observe: