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