Esempio
Scopri se il "ALT" tasto è stato premuto quando un pulsante del mouse viene premuto:
if (event.altKey) {
alert("The ALT key was pressed!");
} else {
alert("The ALT key was NOT pressed!");
}
Prova tu stesso " Definizione e l'utilizzo
La proprietà altKey restituisce un valore booleano che indica se il "ALT" tasto è stato premuto quando un evento del mouse è stato attivato.
Nota: Su alcune tastiere Mac, la "ALT" tasto viene visualizzato come "Option" o "Opt" .
Nota: questa proprietà è di sola lettura.
Supporto browser
Proprietà | |||||
---|---|---|---|---|---|
altKey | sì | sì | sì | sì | sì |
Sintassi
event .altKey
Dettagli tecnici
Valore di ritorno: | Un valore booleano, che indica se il "ALT" 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 ctrlKey Property
Di riferimento HTML DOM: MouseEvent metaKey Property
Di riferimento HTML DOM: MouseEvent shiftKey Property
<Oggetto evento