OBJECT:
Event
An
Event object is created automatically by JavaScript on
the occurance of an event. It has various properties that provide information
about the event such as event type, the position of the cursor at the
time the event occured, etc. Not all of the properties relate to every
type of event; the one's that do are documented in the individual event
handler pages.
The following example creates a button that, when clicked, displays an
alert box showing the event type (in this case a 'click' event).
Code:
<input type="button" value="Event type" onClick='alert("The
event type is " + event.type)'>
PROPERTIES
data Property
This property relates to the DragDrop event and its use returns an array
that contains the URLs of any dropped objects, as strings.
Syntax: event.data
height Property
This property relates to the height of the window or frame that contains
the object that initiated the event.
Syntax: event.height
layerX / layerY Property
These properties returns a number that represents the horizontal/vertical
position, in pixels, of the cursor relative to the layer that initiated
the event, or, when passed with a resize event, it represents the object
width/height. These properties are synonyms for, and interchangable with,
the x and y event object properties.
Syntax: event.layerX
Syntax: event.layerY
modifiers Property
This property returns a string containing details of any modifier keys
that were held down during a key or mouse event. The values of the modifier
keys are as follows: ALT_MASK, CONTROL_MASK, SHIFT_MASK and META_MASK.
Syntax: event.modifiers
pageX / pageY Property
These properties return the horizontal/vertical position of the cursor
relative to the page, in pixels, at the time the event occured.
Syntax: event.pageX
Syntax: event.pageY
screenX / screenY Property
These properties return the horizontal/vertical position of the cursor
relative to the screen, in pixels, at the time the event occured.
Syntax: event.screenX
Syntax: event.screenY
target Property
This property returns a reference to the object that the event
was originally sent to.
Syntax: event.target
type Property
This property returns a string that represents the type of the event (click,
key down, etc.).
Syntax: event.type
which Property
This property returns a number that represents either which mouse button
(1 being the left button, 2 the middle and 3 the right) was pressed or
which key was pressed (its ASCII value) at the time the event occuered.
Syntax: event.which
width Property
This property relates to the height of the window or frame that contains
the object that initiated the event.
Syntax: event.width
x / y Property
These properties returns a number that represents the horizontal/vertical
position, in pixels, of the cursor relative to the layer that initiated
the event, or, when passed with a resize event, it represents the object
width/height. These properties are synonyms for, and interchangable with,
the layerX and layerY event object properties.
Syntax: event.x
Syntax: event.y
METHODS
The Event object inherits the watch and unwatch methods of the Object
object. |