
CHAPTER 4: User-Interface Tools Event handling 151
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
Comentários a estes Manuais