Esempio
Scopri se il "CTRL" tasto è stato premuto quando un pulsante del mouse viene premuto:
if (event.ctrlKey) {
alert("The CTRL key was pressed!");
} else {
alert("The CTRL key was NOT pressed!");
}
Prova tu stesso " Definizione e l'utilizzo
La proprietà ctrlKey restituisce un valore booleano che indica se il "CTRL" tasto è stato premuto quando un evento del mouse è stato attivato.
Nota: questa proprietà è di sola lettura.
Supporto browser
Proprietà | |||||
---|---|---|---|---|---|
ctrlKey | sì | sì | sì | sì | sì |
Sintassi
event .ctrlKey
Dettagli tecnici
Valore di ritorno: | Un valore booleano, che indica se il "CTRL" tasto è stato premuto quando l'evento del mouse si è verificato. Valori possibili:
|
---|---|
DOM Versione: | Livello DOM 2 Eventi |
Pagine correlate
Di riferimento HTML DOM: MouseEvent altKey Property
Di riferimento HTML DOM: MouseEvent metaKey Property
Di riferimento HTML DOM: MouseEvent shiftKey Property
<Oggetto evento