[Contents]
[Previous] [Next] [Last]This section describes new and revised events.
All information about an event, such as its type, is now passed to its handler through theevent
object. The properties passed with the event
object are listed under the
heading "Event properties used." Pre-Navigator 4.0 events that aren't listed
here use the type
and target
property only.
In Navigator 4.0, a window or document can capture events before they reach their intended target. For more information see "Event Capturing".
(Revised to include new properties) Occurs when the user clicks a link or a form element (a Click is a combination of the MouseDown and MouseUp events).
If the event handler returns false, the default action of the object is canceled as follows:onClick="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
document
, Button
, Checkbox
, Link
, Radio
,
Reset
, and Submit
objects
type
indicates a Click event.
target
indicates the object to which the event was
originally sent.
When a link is clicked, layerX
, layerY
,
pageX
, pageY
, screenX
, and screenY
represent the cursor location at the time the Click event occurred.
When a button is clicked, layerX
, layerY
,
pageX
, pageY
, screenX
, and screenY
are
unused.
which
represents 1 for a left-mouse click and 3 for
a right-mouse click.
modifiers
contains the list of modifier keys held
down when the Click event occurred.
Occurs when the user double-clicks a form element or a link.
onDblClick="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
document
, area
, link
object
type
indicates a DblClick event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the DblClick event occurred.
which
represents 1 for a left-mouse double-click and
3 for a right-mouse double-click.
modifiers
contains the list of modifier keys held
down when the DblClick event occurred.
Occurs when the user drops an object onto the Navigator window, such as dropping a file on the Navigator window.
onDragDrop="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
window
object
type
indicates a DragDrop event.
target
indicates the object to which the event was
originally sent.
data
returns an array of strings containing the URLs
of the dropped objects.
The DragDrop event is fired whenever a system item (file, shortcut, etc.) is dropped onto the Navigator window via the native system's drag and drop mechanism. The normal response for the Navigator is to attempt to load the item into the browser window. If the event handler for the DragDrop event returns true, the browser will load the item normally. If the event handler returns false, the drag and drop is canceled.
Occurs when the user depresses a key.
onKeyDown="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
document
, Image
, Link
, and Textarea
objects
type
indicates a KeyDown event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the KeyDown event occurred.
which
represents the ASCII value of the key pressed.
To get the actual letter, number, or symbol of the pressed key, use the fromCharCode
method. To set this property when the ASCII value is unknown, use the charCodeAt
method.
modifiers
contains the list of modifier keys held down
when the KeyDown event occurred.
A KeyDown event always occurs before a KeyPress event. If onKeyDown returns false
,
no KeyPress events occur. This prevents KeyPress events occurring due to the user holding
down a key.
KeyPress
and KeyUp
events
Client-side event. Occurs when the user presses or holds down a key.
onKeyPress="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
document
, Image
, Link
, and Textarea
objects
type
indicates a KeyPress event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the KeyPress event occurred.
which
represents the ASCII value of the key pressed.
To get the actual letter, number, or symbol of the pressed key, use the fromCharCode
method. To set this property when the ASCII value is unknown, use the charCodeAt
method.
modifiers
contains the list of modifier keys held down
when the KeyPress event occurred.
A KeyPress event occurs immediately after a KeyDown event only if onKeyDown returns
something other than false
. A KeyPress event repeatedly occurs until the user
releases the key. You can cancel individual KeyPress events.
KeyDown
and KeyUp
events
Event. Occurs when the user releases a key.
onKeyUp="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
document
, Image
, Link
, and Textarea
objects
type
indicates a KeyUp event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the KeyUp event occurred.
which
represents the ASCII value of the key pressed.
To get the actual letter, number, or symbol of the pressed key, use the fromCharCode
method. To set this property when the ASCII value is unknown, use the charCodeAt
method.
modifiers
contains the list of modifier keys held down
when the KeyUp event occurred.
Occurs when the user depresses a mouse button.
onMouseDown="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
Button
, document
, and Link
objects
type
indicates a MouseDown event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the MouseDown event occurred.
which
represents 1 for a left-mouse-button down and
3 for a right-mouse-button down.
modifiers
contains the list of modifier keys held
down when the MouseDown event occurred.
If onMouseDown returns false
, the default action (entering drag mode,
entering selection mode, or arming a link) is canceled.
Occurs when the user moves the cursor.
onMouseMove="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
None
type
indicates a MouseMove event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the MouseMove event occurred.
The MouseMove event is sent only when a capture of the event is requested by an object (see
"Event Capturing").
captureEvents
method
(Revised to include new properties) Occurs when the user moves the cursor out of an object.
onMouseOut="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
Area
, Layer
, and Link
objects
type
indicates a MouseOut event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the MouseOut event occurred.
(Revised to include new properties) Occurs when the user moves the cursor over an object.
onMouseOver="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
Area
, Layer
, and Link
objects
type
indicates a MouseOver event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the MouseOver event occurred.
Occurs when the user releases a mouse button.
onMouseUp="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
Button
, document
, and Link
objects
type
indicates a MouseUp event.
target
indicates the object to which the event was
originally sent.
layerX
, layerY
, pageX
, pageY
,
screenX
, and screenY
represent the cursor location at the time
the MouseUp event occurred.
which
represents 1 for a left-mouse-button up and 3
for a right-mouse-button up.
modifiers
contains the list of modifier keys held
down when the MouseUp event occurred.
If onMouseUp returns false
, the default action is canceled. For example,
if onMouseUp returns false
over an armed link, the link is not triggered.
Also, if MouseUp occurs over an unarmed link (possibly due to onMouseDown returning
false), the link is not triggered.
Occurs when the user or script moves a window.
onMove="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
window
object
type
indicates a Move event.
target
indicates the object to which the event was
originally sent.
screenX
and screenY
represent the
position of the top-left corner of the window.
Occurs when a user or script resizes a window.
onResize="handlerText"
handlerText
is JavaScript code or a call to a JavaScript function.
window
objects
type
indicates a Resize event.
target
indicates the object to which the event was
originally sent.
width
and height
represent the width
and height of the window.
This event is sent after HTML layout completes within the new window inner dimensions.
This allows positioned elements and named anchors to have their final sizes and locations
queried, image SRC
properties can be restored dynamically, and so on.
[Contents]
[Previous] [Next] [Last]Last Updated: 10/22/97 11:48:01
Copyright © 1997 Netscape Communications Corporation