initUIEvent()
eventObj.initUIEvent (eventName, bubble, isCancelable, view, detail) eventName The event name string.
bubble When true, the event should be triggered in ancestors of the target object during the bubbling phase.
isCancelable When true, the event can be cancelled.
view The container or control object that dispatched the event.
detail Details of the event, which vary according to the event type. The value is 1 or 2 for the click event, indicating a single or double click.
Modifies an event before it is dispatched to its targets. Takes effect only if UIEvent.eventPhase is
Event.NOT_DISPATCHING. Ignored at all other phases.
Returns undefined.
preventDefault()
eventObj.preventDefault ( )
Cancels the default action of this event, if this event is cancelable (that is, cancelable is true). For example, the default click action of an OK button is to close the containing dialog; this call prevents that behavior.
Returns undefined. stopPropagation()
eventObj.stopPropagation ( )
Stops event propagation (bubbling and capturing) after executing the handler or handlers at the current target.
KeyboardEvent object
This type of object is passed to your registered event handler when a keyboard-input event occurs. The properties reflect the keypress and key modifier state at the time the keyboard event was generated. All properties are read-only.
KeyboardEvent object properties
In addition to the properties defined for UIEvent base class, a keyboard event has these properties. All properties are read-only.
altKey Boolean When true, the ALT key was active. Value is undefined if the
keyIdentifier is for a modifier key.
ctrlKey Boolean When true, the CTRL key was active. Value is undefined if the keyIdentifier is for a modifier key.
metaKey Boolean When true, the META or COMMAND key was active. Value is undefined if the
keyIdentifier is for a modifier key.
shiftKey Boolean When true, the SHIFT key was active. Value is undefined if the keyIdentifier is for a modifier key.
keyIdentifier String The key whose keypress generated the event, as a W3C identifier contained in a string; for example, "U+0044". See
http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set. keyLocation Number A constant that identifies where on the keyboard the keypress occurred.
One of:
DOM_KEY_LOCATION_STANDARD DOM_KEY_LOCATION_LEFT DOM_KEY_LOCATION_RIGHT DOM_KEY_LOCATION_NUMPAD
keyName String The key whose keypress generated the event, as a simple key name; for example "A".
type String The name of the event that occurred. Key events types are:
keyup keydown
KeyboardEvent object functions
In addition to the functions defined for UIEvent base class, a keyboard event has these functions.
getModifierState()
eventObj.getModifierState (keyIdentifier)
keyIdentifier A string containing a modifier key identifier, one of:
Alt CapsLock Control Meta NumLock Scroll Shift
Returns true if the given modifier was active when the event occurred, false otherwise. initKeyboardEvent()
eventObj.initKeyboardEvent (eventName, bubble, isCancelable, view, keyID, keyLocation, modifiersList)
eventName The event name string.
bubble When true, the event should be triggered in ancestors of the target object during the bubbling phase.
isCancelable When true, the event can be cancelled.
view The container or control object that dispatched the event.
keyID Sets the keyIdentifier value. keyLocation Sets the keyLocation. value.
modifiersList A whitespace-separated string of modifier key names, such as "Control Alt". Reinitializes the object, allowing you to change the event properties after construction. Arguments set the corresponding properties. Returns undefined.
MouseEvent object
This type of object is passed to your registered event handler when a mouse-input event occurs. The properties reflect the button and modifier-key state and pointer position at the time the event was generated.
In the case of nested elements, mouse event types are always targeted at the most deeply nested element. Ancestors of the targeted element can use bubbling to obtain notification of mouse events which occur within its descendent elements.
MouseEvent object properties
In addition to the properties defined for UIEvent base class, a mouse event has these properties. All properties are read-only.
altKey Boolean When true, the ALT key was active. Value is undefined if the keyIdentifier is for a modifier key.
button Number Which mouse button changed state.
0—The left button of a two- or three-button mouse or the one button on a one-button mouse, used to activate a UI button or select text. 1— The middle button of a three-button mouse, or the mouse wheel. 2—The right button, used to display a context menu, if present. Some mice may provide or simulate more buttons, and values higher than 2 represent such buttons.
clientX clientY
Number The horizontal and vertical coordinates at which the event occurred relative to the target object. The origin is the top left of the control or window, inside any border decorations.
ctrlKey Boolean When true, the CTRL key was active. Value is undefined if the keyIdentifier is for a modifier key.
detail Number Details of the event, which vary according to the event type. For the
click, mousedown, and mouseup events, the value is 1 for a single click, or 2 for a double click.
metaKey Boolean When true, the META or COMMAND key was active. Value is undefined if the keyIdentifier is for a modifier key.
relatedTarget Object X For a mouseover event, the UI element the pointer is leaving, if any.
X For a mouseout event, the UI element the pointer is entering, if any. X Otherwise undefined.
screenX screenY
Number The horizontal and vertical coordinates at which the event occurred relative to the screen.
MouseEvent object functions
In addition to the functions defined for UIEvent base class, a mouse event has these functions. shiftKey Boolean When true, the SHIFT key was active. Value is undefined if the
keyIdentifier is for a modifier key.
type String The name of the event that occurred. Mouse events types are:
mousedown mouseup mousemove mouseover mouseout
click (detail = 1 for single, 2 for double)
The sequence of click events is: mousedown, mouseup, click.
getModifierState()
eventObj.getModifierState (keyIdentifier)
keyIdentifier A string containing a modifier key identifier, one of:
Alt CapsLock Control Meta NumLock Scroll Shift
Returns true if the given modifier was active when the event occurred, false otherwise. initMouseEvent()
eventObj.initMouseEvent (eventName, bubble, isCancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget)
eventName The event name string.
bubble When true, the event should be triggered in ancestors of the target object during the bubbling phase.
isCancelable When true, the event can be cancelled.
view The container or control object that dispatched the event.
detail Sets the single-double click value for the click event.
screenX, screenY
Sets the event coordinates relative to the screen.
clientX, clientY
Sets the event coordinates relative to the target object. The origin is the top left of the control or window, inside any border decorations.
ctrlKey, altKey, metaKey