event
object contains properties that describe a JavaScript event, and is
passed as an argument to an event handler when the event occurs.
Client-side object | |
Implemented in | Navigator 4.0 |
event
object contains the type of event (in this case MouseDown), the x and y position of the cursor at the time of the event, a number representing the mouse button used, and a field containing the modifier keys (Control, Alt, Meta, or Shift) that were depressed at the time of the event. The properties used within the event
object vary from one type of event to another. This variation is provided in the descriptions of individual event handlers.
For more information, see "General Information about Events".
Created by
event
objects are created by Communicator when an event occurs. You do not create them yourself.
Security
Setting any property of this object requires the UniversalBrowserWrite
privilege. In addition, getting the data
property of the DragDrop
event requires the UniversalBrowserRead
privilege. For information on security in Navigator 4.0, see Chapter 7, "JavaScript Security," in the JavaScript Guide.
Property Summary
Not all of these properties are relevant to each event type. To learn which
properties are used by an event, see the "Event object properties used" section
of the individual event handler.
<A HREF="http://home.netscape.com" onClick='alert("Link got an event: "The following example uses the event object in an explicitly called event handler.
+ event.type)'>Click for link event</A>
<SCRIPT>
function fun1(evnt) {
alert ("Document got an event: " + evnt.type);
alert ("x position is " + evnt.layerX);
alert ("y position is " + evnt.layerY);
if (evnt.modifiers & Event.ALT_MASK)
alert ("Alt key was down for event.");
return true;
}
document.onmousedown = fun1;
</SCRIPT>
Last Updated: 10/31/97 16:34:02