0

我想通过单击键盘上的下一步按钮(右箭头>)来进行下一步。我怎样才能做到这一点?我找到了一个解决方案,但在 100% 成功之前失败了。

<html>

    <head>
        <script src="jquery-1.4.2.js"></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(document).bind('keydown', 'right', function (evt) {
                    location.href = $('#previous_page_link').href;
                    //window.location.href = 'http://www.google.com';
                });
            }
            jQuery(document).ready(domo);
        </script>
    </head>

    <body>
        <a id="previous_page_link" href="http://www.google.com">Google</a>
        <a id="next_page_link" href="http://www.yahoo.com">Yahoo</a>
    </body>

</html>

https://github.com/jeresig/jquery.hotkeys

4

1 回答 1

0

尝试:

jQuery(document).ready(function() {
     jQuery(document).bind('keydown', 'right', function () {
          location.href = $('#previous_page_link').attr('href');
       });
   });
于 2012-05-16T21:56:34.107 回答