JS实现 键盘操作

JS实现 键盘操作:

详情可以去其逛网查看其API并下载,地址:http://craig.is/killing/mice

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="js/mousetrap.min.js" type="text/javascript"></script>
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            Mousetrap.bind('4', function () { alert("按下了4键"); });

            Mousetrap.bind('enter', function () { alert("按下了enter键"); });
            Mousetrap.bind('x', function () { alert("按下了x键"); }, 'keyup');

            Mousetrap.bind('shift+k', function (e) {
                alert("按下了组合键shift+k");
                return false;
            });

        });</script>
</head>
<body>
</body>
</html>

http://www.cnblogs.com/lhmlyx2723356/p/4243237.html

原文地址:https://www.cnblogs.com/allen0118/p/4276807.html