# class KeyboardEvent

###

Module | khtml
Namespace | DOM
Class | KeyboardEvent
Inherits | DOM::UIEvent

### enums

- KeyLocation { DOM_KEY_LOCATION_STANDARD, DOM_KEY_LOCATION_LEFT, DOM_KEY_LOCATION_RIGHT, DOM_KEY_LOCATION_NUMPAD }

enum details

### methods

- KeyboardEvent ( )

  returns ctor

- KeyboardEvent (other)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  other | DOM.KeyboardEvent |

- KeyboardEvent (other)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  other | DOM.Event |

- altKey ( )

  returns bool

  altKey of type boolean, readonly

  true if the alt (Alt) key modifier is activated.

- ctrlKey ( )

  returns bool

  ctrlKey of type boolean, readonly

  true if the control (Ctrl) key modifier is activated.

- getModifierState (keyIdentifierArg)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  keyIdentifierArg | DOM.DOMString |

  getModifierState

  This methods queries the state of a modifier using a key identifier

  Parameters:

  keyIdentifierArg of type DOMString A modifier key identifier. Supported modifier keys are "Alt", "Control", "Meta", "Shift".

  Return Value boolean true if it is modifier key and the modifier is activated, false otherwise.

- initKeyboardEvent (typeArg, canBubbleArg, cancelableArg, viewArg, keyIdentifierArg, keyLocationArg, modifiersList)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  typeArg | DOM.DOMString |
  canBubbleArg | bool |
  cancelableArg | bool |
  viewArg | DOM.AbstractView |
  keyIdentifierArg | DOM.DOMString |
  keyLocationArg | unsigned long |
  modifiersList | DOM.DOMString |

  initKeyboardEvent

  The initKeyboardEvent method is used to initialize the value of a KeyboardEvent object and has the same behavior as UIEvent.initUIEvent(). The value of UIEvent.detail remains undefined.

  Parameters: typeArg of type DOMString Specifies the event type. canBubbleArg of type boolean Specifies whether or not the event can bubble. cancelableArg of type boolean Specifies whether or not the event's default action can be prevent. viewArg of type views.AbstractView Specifies the TextEvent's AbstractView. keyIdentifierArg of type DOMString Specifies KeyboardEvent.keyIdentifier. keyLocationArg of type unsigned long Specifies KeyboardEvent.keyLocation. modifiersList of type DOMString A white space separated list of modifier key identifiers to be activated on this object.

- keyIdentifier ( )

  returns DOM.DOMString

  keyIdentifier of type DOMString, readonly

  keyIdentifier holds the identifier of the key. The key identifiers are defined in Appendix A.2 "Key identifiers set" (http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set)

- keyLocation ( )

  returns unsigned long

  keyLocation of type unsigned long, readonly

  The keyLocation attribute contains an indication of the location of they key on the device. See the KeyLocation enum for possible values

- metaKey ( )

  returns bool

  metaKey of type boolean, readonly

  true if the meta (Meta) key modifier is activated.

- shiftKey ( )

  returns bool

  shiftKey of type boolean, readonly

  true if the shift (Shift) key modifier is activated.

### enums - detail

- KeyLocation { DOM_KEY_LOCATION_STANDARD, DOM_KEY_LOCATION_LEFT, DOM_KEY_LOCATION_RIGHT, DOM_KEY_LOCATION_NUMPAD }

  The key activation is not distinguished as the left or right version of the key, and did not originate from the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad). Example: the 'Q' key on a PC 101 Key US keyboard.

  | DOM_KEY_LOCATION_STANDARD | - 0x00 | - |
  | DOM_KEY_LOCATION_LEFT | - 0x01 | - |
  | DOM_KEY_LOCATION_RIGHT | - 0x02 | - |
  | DOM_KEY_LOCATION_NUMPAD | - 0x03 | - |