Make your own free website on Tripod.com

Handling Events


Events are generated when specific actions occur. With JavaScript you can provide functions to handle these events.

The basic form of an event handler is:

Events in JavaScript

Event Description
blur Occurs when input focus is removed from a form element (when the user clicks outside a field)
click Occurs when the user clicks on a link or form element
change Occurs when the value of a form field is changed by the user
focus Occurs when input focus is given to a form element
load Occurs when a page is loaded
mouseover Occurs when the user moves the pointer over a hypertext link
select Occurs when the user selects a form element's field
submit Occurs when a form is submitted (i.e., when the users clicks on a submit button)
unload Occurs when the users leaves a page

Input focus occurs when the user clicks on or in form element or field, or by tabbing to that field.

What Events Occur With What

Object Events
Selection List onBlur, onChange, onFocus
Text element onBlur, onChange, onFocus, onSelect
Textarea element onBlur, onChange, onFocus, onSelect
Button element onClick
Checkbox onClick
Radio button onClick
Hypertext link onClick, onMouseOver
Reset button onClick
Submit button onClick
Document onLoad, onUnload
Window onLoad, onUnload
Form onSubmit

Back