Easy Tutorial
❮ Prop Style Borderimagewidth Prop Text Size ❯

location Event Property

Event Object

Example

Get the location of the key:

var x = event.location;

x output result:

0

Definition and Usage

The location property returns the location of a key on the keyboard or device.

The number can be represented by 4 constants:

0. DOMKEYLOCATION_STANDARD:

Indicates a key that is not on the left or right side of the keyboard and not a numeric keypad key (this value covers almost all keys, such as "A", "U", "SPACE", or "5")

1. DOMKEYLOCATION_LEFT:

Left key (if the left "CTRL" key or left "ALT" key)

2. DOMKEYLOCATION_RIGHT:

Right key (if the right "CTRL" key or left "ALT" key)

3. DOMKEYLOCATION_NUMPAD:

Numeric key (on the right side of the standard keyboard)

Note: The location property can be used with onkeydown and onkeyup events, but not with onkeypress events.

Note: This property is read-only.


Browser Support

The numbers in the table specify the first browser version that supports the property.

Property
location Yes 9.0 15.0 Not supported Yes

Syntax

Technical Details

Return Value: Number, representing the location of a key on the keyboard or device. 4 numbers can be represented by constants: 0. DOM_KEY_LOCATION_STANDARD1. DOM_KEY_LOCATION_LEFT2. DOM_KEY_LOCATION_RIGHT3. DOM_KEY_LOCATION_NUMPAD
DOM Version: DOM Level 3 Events
--- ---

Event Object

❮ Prop Style Borderimagewidth Prop Text Size ❯