EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.

KeyboardEvent object

Provides event properties that are specific to keyboard events.

Document Object Model (DOM) Level 3 Events Specification, Section 5.2.6

Members

The KeyboardEvent object has these types of members:

Methods

The KeyboardEvent object has these methods.

MethodDescription
getModifierState

Queries the state of the specified modifier key.

initEvent

Initializes a new generic event that the createEvent method created.

initKeyboardEvent

Initializes a new keyboard event that the createEvent method created.

initUIEvent

Initializes a new user interface event that the createEvent method created.

preventDefault

Cancels the default action of an event.

stopImmediatePropagation

Prevents any further propagation of an event.

stopPropagation

Prevents propagation of an event beyond the current target.

 

Properties

The KeyboardEvent object has these properties.

PropertyDescription

altKey

Gets a value that indicates whether the Alt key is pressed.

bubbles

Gets a value that indicates whether an event propagates up from the event target.

cancelable

Gets a value that indicates whether you can cancel an event's default action.

cancelBubble

Gets or sets a value that indicates whether an event should be stopped from propagating up from the current target.

char

Gets a character for a key that is pressed, if available.

charCode

Gets the numeric key code of a key that is pressed.

ctrlKey

Gets a value that indicates whether the Ctrl key is pressed.

currentTarget

Gets the event target that is currently being processed.

defaultPrevented

Gets a value that indicates whether the default action should be canceled.

detail

Gets additional information about an event.

eventPhase

Gets the event phase that is being evaluated.

isTrusted

Gets a value that indicates whether a trusted event source created an event.

key

Gets the key identifier of a key that is pressed.

keyCode

Gets the numeric key code of a key that is pressed.

locale

Gets the locale name for the event.

location

Gets the location of a key on the keyboard or device.

metaKey

Gets a value that indicates whether the Meta/Control key is pressed.

repeat

Gets a value that indicates whether a key was pressed and held.

shiftKey

Gets a value that indicates whether the Shift key is pressed.

srcElement

Gets the element that the event was originally dispatched to. Compare to target.

target

Gets the element that is the target of the event.

timeStamp

Gets the time, in milliseconds, when an event occurred.

type

Gets the name of an event.

view

Gets the window object that an event is generated from.

which

Gets the numeric code of a key that is pressed.

 

Standards information

See also

Reference
onkeydown
onkeypress
onkeyup

 

 

Afficher:
© 2014 Microsoft