--- title: event.ctrlKey slug: Web/API/MouseEvent/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 original_slug: Web/API/Event/ctrlKey ---

{{ ApiRef() }}

Sommario

Indica se il tasto CTRL รจ stato premuto mentre l'evento si verificava.

Sintassi

bool = event.ctrlKey

bool vale true se il tasto CTRL era premuto, altrimenti false.

Esempio

<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>

Specifiche

ctrlKey

{{ languages( { "en": "en/DOM/event.ctrlKey", "pl": "pl/DOM/event.ctrlKey" } ) }}