Page 25 - LoudOffice_Guide-to-HTML_Part-II_Advanced.PDF
P. 25
For example, a hyperlink is subject to a M o u s e O v e r event, meaning that its event handler
will be triggered when the mouse passes over the link. Therefore, you place the event
handler for a hyperlink's M o u s e O v e r inside the A tag:
< a h r e f = " " o n M o u s e O v e r = " p o p u p F u n c ( ) ; " >
The JavaScript which is called by the event handler may be any valid JavaScript code: a
single statement or a series of statements, although most often it is a function call.
The set of all events that may occur, and the particular page elements on which they can
occur, is part of the Document Object Model (DOM), and not JavaScript itself (see the
earlier section "Document Object Model"). As a result, Netscape and Microsoft do not share
the exact same set of events, nor are all page elements subject to the same events between
browsers. For example, Internet Explorer 4 supports a M o u s e O v e r event for an image while
Navigator 4 does not.
The table below illustrates some of the most commonly used events supported in both
DOM's. Because the DOM's differ in their event support, the following documents are
recommended as an overview of each browser's event support:
Common Events
Event Occurs when... Event Handler
Click User clicks on form element or link o n C l i c k
change User changes value of text, textarea, or select element o n C h a n g e
focus User gives form element input focus o n F o c u s
blur User removes input focus from form element o n B l u r
mouseover User moves mouse pointer over a link or anchor o n M o u s e O v e r
mouseout User moves mouse pointer off of link or anchro o n M o u s e O u t
select User selects form element's input field o n S e l e c t
submit User submits a form o n S u b m i t
resize User resizes the browser window o n R e s i z e
load User loads the page in the Navigator o n L o a d
unload User exits the page o n U n l o a d
LoudOffice.com Guide to HTML – Part II Page 25