public interface KeyboardEvent extends UIEvent
Deprecated
KeyboardEvent
objects describe a user interaction with the keyboard. Each event describes a key; the event type (keydown
, keypress
, or keyup
) identifies what kind of activity was performed.
KeyboardEvent
interface is deprecated in DOM Level 3 in favor of the new TextInput
interface and the corresponding textinput
event, which have improved support for alternate input methods. However, DOM Level 3 textinput
events are not yet implemented in Gecko (as of version 6.0), so code written for Gecko browsers should continue to use KeyboardEvent
for now.Modifier and Type | Interface and Description |
---|---|
static interface |
KeyboardEvent.KeyCode
Defines the expected key codes returned by
getKeyCode() . |
static interface |
KeyboardEvent.KeyLocation
Defines the standard key locations returned by
getKeyLocation() . |
static interface |
KeyboardEvent.KeyName
Defines the standard keyboard identifier names for keys that are returned
by
#getKeyboardIdentifier when the key does not have a direct
unicode mapping. |
AT_TARGET, BEFORECOPY, BEFORECUT, BEFOREPASTE, BLUR, BUBBLING_PHASE, CAPTURING_PHASE, CHANGE, CLICK, CONTEXTMENU, COPY, CUT, DBLCLICK, DRAG, DRAGEND, DRAGENTER, DRAGLEAVE, DRAGOVER, DRAGSTART, DROP, ERROR, FOCUS, FOCUSIN, FOCUSOUT, INPUT, INVALID, KEYDOWN, KEYPRESS, KEYUP, MOUSEDOWN, MOUSEMOVE, MOUSEOUT, MOUSEOVER, MOUSEUP, MOUSEWHEEL, NONE, PASTE, RESIZE, SCROLL, SELECTSTART, SUBMIT, TOUCHCANCEL, TOUCHEND, TOUCHMOVE, TOUCHSTART, WEBKITANIMATIONEND, WEBKITANIMATIONITERATION, WEBKITANIMATIONSTART, WEBKITTRANSITIONEND
Modifier and Type | Method and Description |
---|---|
int |
getKeyCode() |
String |
getKeyIdentifier() |
int |
getKeyLocation() |
void |
initKeyboardEvent(String type,
boolean canBubble,
boolean cancelable,
Window view,
String keyIdentifier,
int keyLocation,
boolean ctrlKey,
boolean altKey,
boolean shiftKey,
boolean metaKey,
boolean altGraphKey)
Initializes the attributes of a keyboard event object.
|
boolean |
isAltGraphKey() |
boolean |
isAltKey()
true if the Alt (or Option, on Mac) key was active when the key event was generated. |
boolean |
isCtrlKey()
true if the Control key was active when the key event was generated. |
boolean |
isMetaKey()
true if the Meta (or Command, on Mac) key was active when the key event was generated. |
boolean |
isShiftKey()
true if the Shift key was active when the key event was generated. |
getCharCode, getDetail, getLayerX, getLayerY, getPageX, getPageY, getView, getWhich, initUIEvent
getClipboardData, getCurrentTarget, getEventPhase, getSrcElement, getTarget, getTimeStamp, getType, initEvent, isBubbles, isCancelable, isCancelBubble, isDefaultPrevented, isReturnValue, preventDefault, setCancelBubble, setReturnValue, stopImmediatePropagation, stopPropagation
int getKeyCode()
getKeyCode
in interface UIEvent
boolean isAltGraphKey()
boolean isAltKey()
true
if the Alt (or Option, on Mac) key was active when the key event was generated. Read only.boolean isCtrlKey()
true
if the Control key was active when the key event was generated. Read only.String getKeyIdentifier()
int getKeyLocation()
boolean isMetaKey()
true
if the Meta (or Command, on Mac) key was active when the key event was generated. Read only.boolean isShiftKey()
true
if the Shift key was active when the key event was generated. Read only.void initKeyboardEvent(String type, boolean canBubble, boolean cancelable, Window view, String keyIdentifier, int keyLocation, boolean ctrlKey, boolean altKey, boolean shiftKey, boolean metaKey, boolean altGraphKey)
Initializes the attributes of a keyboard event object.
typeArg
keydown
, keypress
, or keyup
.canBubbleArg
cancelableArg
viewArg
charArg
keyArg
locationArg
modifiersListArg
repeatArg
localeArg
Copyright © 2018. All rights reserved.