-1
我有一些功能。例如使用.keypress運行函數jQuery
<script>
//Function1
alert('Function 1 run')
//Function2
alert('Function 2 run')
</script>
我需要.keypress jQuery
運行該功能,例如按special key 1 + special key 2
像Ctrl + Character
<script>
('html').on('keypress' , ' Ctrl + A ' , function() {
alert('Function 1 run')
});
('html').on('keypress' , ' Ctrl + B ' , function() {
alert('Function 2 run')
});
</script>
所以你會u人建議我?
沒有嘗試'$(文件)。在('按鍵...' – joyBlanks
** [鏈接](HTTP:/ /stackoverflow.com/questions/2767126/how-to-detect-that-ctrlr-was-pressed)**,** [鏈接](http://stackoverflow.com/questions/2903991/how-to-detect- ctrlv-ctrlc -using-javascript)**和** [鏈接](http://stackoverflow.com/questions/9374915/javascript-detect-ctrl-key-pressed-or-up-keypress-event-doest-trigger )**。 –
您可以使用jquery插件作爲hotkeys.js –