keydown事件下HotKey插件的问题

时间:2015-04-09 10:12:22

标签: jquery html

我使用hotkeys.js插件进行keydown事件。然后当我只按ctrl并调用最后一个函数时调用Event。请帮帮我。

<script src="jquery.js"></script>
<script src="hotkeys.js"></script>
<script>
    $(document).ready(function() {
        $(document).bind('keydown', 'ctrl+h', function() {
            window.location.replace("home.php");
        });
        $(document).bind('keydown', 'ctrl+i', function() {
            window.location.replace("add item.php");
        });
        $(document).bind('keydown', 'ctrl+m', function() {
            window.location.replace("add make.php");
        });
        $(document).bind('keydown', 'ctrl+q', function() {
            window.location.replace("add sales.php");
        });
        $(document).bind('keydown', 'ctrl+z', function() {
            window.location.replace("add purchase.php");
        });
        $(document).bind('keydown', 'ctrl+a', function() {
            window.location.replace("add account.php");
        });
        $(document).bind('keydown', 'ctrl+b', function() {
            window.location.replace("add user.php");
        });
        $(document).bind('keydown', 'ctrl+x', function() {  
            window.location.replace("add department.php");
        });
    });
</script>

这是我使用的热键插件:https://github.com/jeresig/jquery.hotkeys

我只想要一个键盘快捷键导航到我项目中的页面。

0 个答案:

没有答案