[an error occurred while processing this directive]
javascript tutorial graphic


Webteacher Software now offers

EVENTS

Every object on your page has certain 'Events' which can trigger your JavaScript functions. For example, we use the 'onClick' event of the form button to indicate that a function will run when the user clicks that object. We define the events in the same HTML tag which we use to place an object on the screen. So a button which runs 'myFunction()' when clicked will be written this way.

<input type=button value="click me" onClick="myFunction()">

I could also use onMouseOver to make an event happen when the user's mouse is over certain objects. For instance a message could appear in an alert box.

Images can't have events, but links can. So I added an onMouseOver event to the above image by creating a link to nothing around it. Here is the code for the above image:

<A HREF="#" OnMouseOver="alert('hi')">
<IMG SRC="http://images.webteacher.com/javascript/images/pointme.gif" BORDER=0 >
</A>

The following table outlines all of the event handlers in NetScape version 3.0
(SOURCE: NETSCAPE'S JAVASCRIPT REFERENCE PAGE)

Event Applies to Occurs when Event handler
abort images User aborts the loading of an image (for example by clicking a link or clicking the Stop button) onAbort
blur windows, frames, and all form elements User removes input focus from window, frame, or form element onBlur
click buttons, radio buttons, checkboxes, submit buttons, reset buttons, links User clicks form element or link onClick
change text fields, textareas, select lists User changes value of element onChange
error images, windows The loading of a document or image causes an error onError
focus windows, frames, and all form elements User gives input focus to window, frame, or form element onFocus
load document body User loads the page in the Navigator onLoad
mouseout areas, links User moves mouse pointer out of an area (client-side image map) or link onMouseout
mouseover links User moves mouse pointer over a link onMouse- Over
reset forms User resets a form (clicks a Reset button) onReset
select text fields, textareas User selects form element's input field onSelect
submit submit button User submits a form onSubmit
unload document body User exits the page onUnload

More about Events

Home | WebData - Web Database Software | Javascript | CGI | Consulting | Map Builder | Contact Us | The Press Room