好吧,这仅适用于IE
8,因此无法在所有浏览器中使用。Microsoft实现了确定按下哪个(右/左)键的功能。
我也发现这篇关于浏览器中的按键,按键,按键事件的奇妙文章。
$('#someelement').bind('click', function(event){ if(event.ctrlKey) { if (event.ctrlLeft) { console.log('ctrl-left'); } else { console.log('ctrl-right'); } } if(event.altKey) { if (event.altLeft) { console.log('alt-left'); } else { console.log('alt-right'); } } if(event.shiftKey) { if (event.shiftLeft) { console.log('shift-left'); } else { console.log('shift-right'); } } });


