Course recommendation:
KeyboardEvent location property
Definition and usage
This number is represented by 4 constants:
The location property returns a number indicating the position of the key on the keyboard or device.0. DOM_KEY_LOCATION_STANDARD:
This key is not pressed on the right or left side of the keyboard, nor on the numeric keypad (this value represents almost every key on the keyboard, such as "A", "U", "SPACE", or "5")1. DOM_KEY_LOCATION_LEFT:
The left key is pressed (for example, the left "CTRL" or left "ALT" key on a standard 101-key US keyboard)2. DOM_KEY_LOCATION_RIGHT:
The right key is pressed (for example, the right "CTRL" or right "ALT" key on a standard 101-key US keyboard)3. DOM_KEY_LOCATION_NUMPAD:
Note:When the key is pressed on the numeric keypad (for example, the "2" key on the right side of a standard keyboard) The location property can only be used onkeydown and event, cannot be used onkeypress.
Note:This property is read-only.
Syntax
event.location
Technical details
Return value: |
Numeric value, indicating the position of the key on the keyboard or device. This number is represented by 4 constants:
|
---|---|
DOM version: | DOM Level 3 Events |
Υποστήριξη Browser
Τα αριθμητικά στο πίνακα σημειώνουν την πρώτη έκδοση του προγράμματος περιήγησης που υποστηρίζει πλήρως την ιδιότητα.
Πρότυπο | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
τοποθεσία | Υποστηρίζεται | 9.0 | 15.0 | Δεν Υποστηρίζεται | Υποστηρίζεται |