<blockquote>
<p><strong>Duplicata possible :</strong><br>
<a href="https://stackoverflow.com/questions/6178431/how-to-catch-enter-keypress-on-textarea-but-not-shiftenter">Comment attraper la touche Entrée sur la zone de texte mais pas Maj + Entrée?</a> </p>
</blockquote>
<p>Comment puis-je détecter Maj + touche vers le bas en JavaScript ?</p>
Réponses
Trop de publicités?
Niet the Dark Absol
Points
154811
var onkeydown = (function (ev) {
var key;
var isShift;
if (window.event) {
key = window.event.keyCode;
isShift = !!window.event.shiftKey; // typecast to boolean
} else {
key = ev.which;
isShift = !!ev.shiftKey;
}
if ( isShift ) {
switch (key) {
case 16: // ignore shift key
break;
default:
alert(key);
// do stuff here?
break;
}
}
});