Latest web development tutorials

location event properties

Event Object Reference Event objects

Examples

Get key location:

var x = event.location;

x The output is:

0

try it"


Definitions and use

location property returns the location of the key on the keyboard or settings.

Digital constant can be four, he said:

0. DOM_KEY_LOCATION_STANDARD:

Represents not the leftmost or rightmost button, nor is the number on the numeric keypad (This value includes almost all of the buttons, such as "A", "U", "SPACE" or "5")

1. DOM_KEY_LOCATION_LEFT:

The left button (if the left side of the "CTRL" key or the left of the "ALT" key)

2. DOM_KEY_LOCATION_RIGHT:

The right of the button (if the right side of the "CTRL" key or the left of the "ALT" key)

3. DOM_KEY_LOCATION_NUMPAD:

Keypad (standard keypad on the right)

Note: location attribute can be used onkeydown and onkeyup event, but not for onkeypress events.

Note: This property is read-only.


Browser Support

Figures in the table represent the first browser to support the property version number.

Attributes
location Yes 9.0 15.0 not support Yes


grammar

event .location

technical details

return value: Digital, represents the position of the keyboard or keys on the device.

Four digital can be used to represent constants:

0. DOM_KEY_LOCATION_STANDARD
1. DOM_KEY_LOCATION_LEFT
2. DOM_KEY_LOCATION_RIGHT
3. DOM_KEY_LOCATION_NUMPAD

DOM version: DOM Level 3 Events


Event Object Reference Event objects