XPlatformEvent
A cross-platform representation of an Html Event.
- Object
- XPlatformEvent
Remarks
This class provides methods for accessing information
about Html events in a cross platform way.
Methods
getKeyChar | Gets a string representation of a keyboard event. |
getKeyCode | Gets the keycode for a keyboard event. |
getTarget | Gets the target element for the given event. |
preventDefault | Tells this event to prevent its default behavior. |
stopPropagation | Tells this event to stop propagating. |
XPlatformEvent getKeyChar method
Gets a string representation of a keyboard event.
JavaScript
var strVal = xPlatformEvent.getKeyChar()
Returns
A single-character string.
XPlatformEvent getKeyCode method
Gets the keycode for a keyboard event.
JavaScript
var intVal = xPlatformEvent.getKeyCode()
Remarks
This either uses
evt.keyCode()
, or
evt.which
, depending on the user's browser.Returns
An integer keycode, or undefined if the event is not a keyboard event.
XPlatformEvent getTarget method
Gets the target element for the given event.
JavaScript
var element = xPlatformEvent.getTarget()
Remarks
Returns evt.target, or evt.srcElement if the event has no target.
Returns
The DOM element that the event came from.
XPlatformEvent preventDefault method
Tells this event to prevent its default behavior.
JavaScript
xPlatformEvent.preventDefault()
Remarks
This either calls
evt.preventDefault()
, or sets
evt.returnValue = false
, depending on user's browser.XPlatformEvent stopPropagation method
Tells this event to stop propagating.
JavaScript
xPlatformEvent.stopPropagation()
Remarks
This either calls
evt.stopPropagation()
, or sets
evt.cancelBubble = true
, depending on user's browser.