jquery.hotkeys文件下载: http://xiazai.jb51.net/201405/yuanma/jquery_hotkeys(jb51.net).rar
参照了一下它的文档用法,我们可以这样使用:
<script src=”jquery-1.4.1.min.js” type=”text/javascript”></script>
<script src=”jquery.hotkeys.js” type=”text/javascript”></script>
<script type=”text/javascript”>
$(function () {
$(document).bind(“keydown”, “esc”, function (ev) { alert(“您按下了Esc键!”); //其它处理事件; return false; })
.bind(“keydown”, “1”, function (er) { alert(“您按下了1键!”); return false; })
.bind(“keydown”, “2”, function (er) { alert(“您按下了2键!”); return false; })
.bind(“keydown”, “3”, function (er) { alert(“您按下了3键!”); return false; })
.bind(“keydown”, “4”, function (er) { alert(“您按下了4键!”); return false; })
});
</script>
效果:
下面是全部按键组合
<script src=”jquery.hotkeys.js”></script>
<script>
//This page is a result of an autogenerated content made by running test.html with firefox.
function domo(){
jQuery(‘#platform-details’).html(‘<code>’ + navigator.userAgent + ‘</code>’);
jQuery(document).bind(‘keydown’, ‘esc’,function (evt){jQuery(‘#_esc’).addClass(‘dirty’); return false; });
jQuery(document).bind(‘keydown’, ‘tab’,function (evt){jQuery(‘#_tab’).addClass(‘dirty’); return false; });
jQuery(document).bind(‘keydown’, ‘space’,function (evt){jQuery(‘#_space’).addClass(‘dirty’); return false; });










