js监听回车键

<script type="text/javascript">
document.onkeydown = function (e) {
          var theEvent = window.event || e;
           var code = theEvent.keyCode || theEvent.which;
           if (code == 13) {
               $("#btnSub").click();
           }
       }
</script>


猜你喜欢

转载自blog.csdn.net/u011504963/article/details/79321590