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