Ho un anchor tag che chiama una funzione JavaScript.
Con o senza JQuery come faccio a determinare se il tasto Maiusc è premuto mentre si fa clic sul collegamento?
Il codice seguente NON funziona perché la pressione del tasto viene attivata solo se viene premuto un "tasto reale" (non il tasto MAIUSC). (Speravo che si sarebbe attivato se fosse stato premuto solo il tasto Maiusc.)
var shifted = false;
$(function() {
$(document).keypress(function(e) {
shifted = e.shiftKey;
alert('shiftkey='+e.shiftkey);
});
$(document).keyup(function(e) {
shifted = false;
});
}
...
function myfunction() {
//shift is always false b/c keypress not fired above
}
shiftkeyposto dishiftKey:-)