Esempio
Scopri se il "META" tasto è stato premuto quando si preme un tasto della tastiera:
var x = document.getElementById("demo");
if (event.metaKey) {
x.innerHTML = "The META key was pressed!";
} else {
x.innerHTML = "The META key was NOT pressed!";
}
Prova tu stesso " Definizione e l'utilizzo
La proprietà metakey restituisce un valore booleano che indica se il "META" tasto è stato premuto quando un evento chiave è stato attivato.
Non tutte le tastiere hanno il tasto Meta. E 'comune per Sun tastiere microsistemi, e il MIT e tastiere delle macchine LISP. Il tasto Meta è o etichettato "META" o contrassegnato con un diamante solido "◆" simbolo.
Alle tastiere Mac, il tasto Meta è rappresentato dal il "Command/Cmd" ("⌘") chiave.
Nota: questa proprietà è di sola lettura.
Supporto browser
Proprietà | |||||
---|---|---|---|---|---|
metaKey | sì | sì | sì | sì | sì |
Sintassi
event .metaKey
Dettagli tecnici
Valore di ritorno: | Un valore booleano, che indica se il "META" tasto è stato premuto quando l'evento chiave è verificato. Valori possibili:
|
---|---|
DOM Versione: | Livello DOM 2 Eventi |
Pagine correlate
Di riferimento HTML DOM: KeyboardEvent altKey Property
Di riferimento HTML DOM: KeyboardEvent ctrlKey Property
Di riferimento HTML DOM: KeyboardEvent shiftKey Property
<Oggetto evento