This page is Out of Date

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

initKeyboardEvent

Summary

Initializes a new keyboard event that the createEvent method created.

Method of dom/KeyboardEventdom/KeyboardEvent

Syntax

 event.initKeyboardEvent(eventType, canBubble, cancelable, view, key, location, modifiersList, repeat, locale);

Parameters

eventType

Data-type
String

The name of the event. Sets the value for the type property.

canBubble

Data-type
Boolean

Whether the event propagates upward. Sets the value for the bubbles property.

cancelable

Data-type
Boolean

Whether the event is cancelable and so preventDefault can be called. Sets the value for the cancelable property.

view

Data-type
Object

The window on which this event is occurring. Sets the value for the view property.

key

Data-type
Number

The key identifier. Sets the value for the key property.

location

Data-type
Number

The location of the key on the device. Sets the value for the location property.

modifiersList

Data-type
String

A space-separated list of any of the following values:

  • Alt - The left or right Alt key.
  • AltGraph - The Ctrl and Alt keys.
  • CapsLock - The Caps Lock toggle.
  • Control - The left or right Ctrl key.
  • Meta - The Meta/Control key.
  • NumLock - The Num Lock toggle.
  • ScrollLock - The Scroll Lock toggle.
  • Shift - The left or right Shift key.
  • Fn
  • OS
  • SymbolLock

Other implementation specific options may be supported. For example -

  • Win (on Microsoft Windows) - The left or right Windows logo key.
  • Scroll - The Scroll Lock toggle.

repeat

Data-type
Number

The number of times this key has been pressed. Sets the value for the repeat property.

locale

Data-type
String

The locale name. Sets the value for the locale property.

Return Value

No return value

Notes

The information in this page corresponds to the 20100908 outdated working draft edition of the specifications.

Related specifications

DOM Level 3 Events (20090908)
Outdated Working Draft
DOM Level 3 Events (20100907)
Outdated Working Draft

Attributions