JavaScript Reference :: Event

Event objects are created by the browser and can be handled using JavaScript.

methods

object toSource()
Returns a literal representing the source code of the object e.g "function Object() { [native code] }" or "function Car(manufactuer, model, productionyear) { this.make = manufactuer; this.model = model; this.year = productionyear; }".
string toString()
Returns a string representing the object i.e. "[object Object]".
void unwatch(property)
Removes a previously set watchpoint.
								
object valueOf()
Returns the primitive value of the object e.g. "function Object() { [native code] }".
void watch(property, handlingFunction)
Calls the handlingFunction when the property is changed.
								

properties

altKey
Whether or not the ALT key was pressed during the event.
button
Which mouse button was clicked.
Left mouse-button
1 in IE, 0 in other browsers.
Middle mouse-button
4 in IE, 1 in other browsers.
Right mouse-button
2 in IE, 2 in other browsers.
clientX
The horizontal coordinate when the mouse event was triggered.
clientY
The vertical coordinate when the mouse event was triggered.
constructor
The constructor method is the base method used to create an instance of the object.
ctrlKey
Whether or not the CTRL key was down when the event was triggered.
data
An array containing the URLs of dropped objects
keyCode
An integer representing the key pressed in a KeyDown, KeyPressed, or KeyUp event. In Internet Explorer, the property containing this information is "which". In most cases, this is the ASCII equivalent.
8
Backspace
127
Delete
9
Tab
13
Enter
112
F1
113
F2
114
F3
115
F4
116
F5
117
F6
118
F7
119
F8
120
F9
121
F0
122
F11
123
F12
metaKey
Whether or not the "meta" key was down when the event was triggered.
modifiers
The CTRL, SHIFT, and ALT keys.
prototype
Exposes the prototype for the method or property of the object.
screenX
The horizontal coordinate where the event occurred.
screenY
The vertical coordinate where the event occurred.
shiftKey
Whether or not the SHIFT key was down when the event was triggered.
target
The element in which the event occurred.
type
The name of the event triggered, e.g. mousedown.
which
The Internet Explorer equivalent of keyCode.

events