MouseEvent shiftKey property
Definition and usage
The shiftKey property returns a boolean value indicating whether the "SHIFT" key is pressed when the mouse event is triggered.
Note:This property is read-only.
Example
Determine whether the "SHIFT" key is pressed when clicking the mouse button:
if (event.shiftKey) { alert("The SHIFT key was pressed!"); } alert("The SHIFT key was NOT pressed!"); }
Syntax
event.shiftKey
Technical details
Return value: |
A boolean value indicating whether the "SHIFT" key is pressed when a mouse event occurs. Possible values:
|
---|---|
DOM version: | DOM Level 2 Events |
Webbläsarstöd
Egenskaper | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
shiftKey | Stöd | Stöd | Stöd | Stöd | Stöd |
Relaterade sidor
HTML DOM Referenshandbok:MouseEvent altKey-attribut
HTML DOM Referenshandbok:MouseEvent ctrlKey-attribut
HTML DOM Referenshandbok:MouseEvent metaKey-attribut