A+ A-

Javascript is an event driven language

Javascript events :


As you can tell from the input examples, Javascript is an event driven language which means
your scripts react to events you set up. Your code isn't running all the time, it simply waits until
an event starts something up! Going into all the Javascript events is beyond the scope of this
document but here's a short-list of common events to get you started.

Event :           onAbort
Description:   An image failed to load.
Event :           onBeforeUnload
Description:   The user is navigating away from a page
Event :            onBlur
Description:  A form field lost the focus (User moved to another field)
Event :            onChange
Description:  The contents of a field has changed.
Event :            onClick
Description:  User clicked on this item.
Event :            onDblClick
Description:  User double-clicked on this item.
Event :            onError
Description:  An error occurred while loading an image.
Event :           onFocus 
Description: User just moved into this form element
Event :           onKey
Description: Down A key was pressed
Event :           onKeyPress
Description:  A key was pressed OR released.
Event :          onKeyUp
Description:  A key was released.
Event :            onLoad
Description:  This object (iframe, image, script) finished loading.
Event :          onMouseDown
Description:  A mouse button was pressed.
Event :            onMouseMove
Description:  The mouse moved.
Event :             onMouseOut
Description:   A mouse moved off of this element.
Event :          onMouseOver 
Description:  The mouse moved over this element.
Event :            onMouseUp
Description:  The mouse button was released.
Event :           onReset
Description:  A form reset button was pressed.
Event :           onResize
Description:  The window or frame was resized.
Event :            onSelect
Description:  Text has been selected.
Event :            onSubmit
Description:   A form's Submit button has been pressed.
Event :            onUnload
Description:  The user is navigating away from a page. 


These events can be attached to most any HTML tag or form element. Of them all onClick will probably be what you end up using most often.

As you can tell from the input examples, Javascript is an event driven language which means your scripts react to events you set up. Your code isn't running all the time, it simply waits until an event starts something up! Going into all the Javascript events is beyond the scope of this document but here's a short-list of common events to get you started.