Easy Tutorial
❮ Met Canvas Lineto Prop Win Name ❯

ctrlKey Event Property


Definition and Usage

The ctrlKey event property returns a Boolean value indicating whether the Ctrl key was pressed and held when the event occurred.

Syntax


Example

Example

The following example prompts whether the "CTRL" key is held down when the mouse button is clicked:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function isKeyPressed(event){
    if (event.ctrlKey==1){
        alert("CTRL key is pressed!");
    }else{
        alert("CTRL key is not pressed!");
    }
}
</script>
</head>
<body onmousedown="isKeyPressed(event)">

<p>Click somewhere in the document. An alert box will tell you if you pressed the CTRL key.</p>

</body>
</html>

❮ Met Canvas Lineto Prop Win Name ❯