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