Click somewhere in the document. An alert box will tell you if you pressed the CTRL key.
[Try it Β»](#) * * Event Object](#)Event Ctrlkey
# ctrlKey Event Property
[ Event Object](#)
* * *
## Definition and Usage
The ctrlKey event property returns a boolean value indicating whether the Ctrl key was pressed and held down when the event occurred.
## Syntax
event.ctrlKey=true|false|1|0
* * *
## Example
## Example
The following example alerts whether the "CTRL" key was held down when the mouse button was clicked:
function isKeyPressed(event){
if (event.ctrlKey==1){
alert("CTRL key was pressed!");
}else{
alert("CTRL key was NOT pressed!");
}
}
YouTip