Visit Mozilla.org

DOM:event.ctrlKey

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Indicates whether the CTRL key was pressed when the event fired.

[edit] Syntax

bool = event.ctrlKey

bool contains true or false, depending on whether the ctrl key was held down or not, when the event fired.

[edit] Example

<html>
<head>
<title>ctrlKey example</title>

<script type="text/javascript">

function showChar(e){
  alert(
    "Key Pressed: " + String.fromCharCode(e.charCode) + "\n"
    + "charCode: " + e.charCode + "\n"
    + "CTRL key pressed: " + e.ctrlKey + "\n"
  );
}

</script>
</head>

<body onkeypress="showChar(event);">
<p>Press any character key, with or without holding down the CTRL key.<br />
You can also use the SHIFT key together with the CTRL key.</p>
</body>
</html>

[edit] Specification

ctrlKey