JavaScript Events

An "event" is a change the software can detect. The list below summarises some of JavaScript's events.

A Short list of JavaScript Events:
onAbort - Occurs when the users stops the loading of an image.
onBlur - Occurs when an object on the page is no longer the 'focus'.
onChange - Occurs when a text field is changed by the user.
onClick - Occurs when the users clicks an object.
onError - Occurs when a document, or image can't load correctly.
onFocus - Occurs when an object takes the 'focus'.
onLoad - Occurs when a page is loaded.
onMouseOver - Occurs when the mouse cursor moves over an object.
onMouseOut - Occurs when the mouse cursor moves off an object.
onSelect - Occurs when the user selects text in a text area.
onSubmit - Occurs when the user clicks the "submit" button on a form.
onUnload - Occurs when the user leaves a document.

(From: Michael Moncur, 1996, JavaScript 1.1, p66)

The programmer writes code to be followed when the event is detected. In the example below an "Alert" window pops up when the user moves the mouse cursor over the text in the "Result" column. (You will need to click OK if the Alert window pops up.)

HTML/JavaScript Code Result
<A HREF = "#" onMouseOver = "window.alert( )"> This is a MouseOver position </A> This is a MouseOver position

NOTE: The Target symbol (ie #) is used as the HREF to avoid sending the browser off to an actual link.

<- Back - MenuNext ->