--- title: event.ctrlKey slug: Web/API/Event/ctrlKey tags: - DOM - Gecko - Reference_del_DOM_di_Gecko - Tutte_le_categorie translation_of: Web/API/MouseEvent/ctrlKey translation_of_original: Web/API/event.ctrlKey ---
{{ ApiRef() }}
Indica se il tasto CTRL รจ stato premuto mentre l'evento si verificava.
bool = event.ctrlKey
bool vale true se il tasto CTRL era premuto, altrimenti false.
<html>
<head>
<title>esempio tasto control</title>
<script type="text/javascript">
function mostraCarattere(e){
alert(
"Tasto premuto: " + String.fromCharCode(e.charCode) + "\n"
+ "Codice carattere: " + e.charCode + "\n"
+ "Tasto CTRL premuto: " + e.ctrlKey + "\n"
);
}
</script>
</head>
<body onkeypress="mostraCarattere(event);">
<p>Prova a premere un tasto tenendo premuto CTRL e prova a premere un tasto senza premere CTRL.<br />
Puoi anche provare a premere CTRL+SHIFT.</p>
</body>
</html>
{{ languages( { "en": "en/DOM/event.ctrlKey", "pl": "pl/DOM/event.ctrlKey" } ) }}