js阻止页面enter键入的事件触发


<!-- 这一段代码阻止了当前document中的 enter键的 keydown 事件 抄自网络-->
<script type="text/javascript"> document.onkeydown = function() { var evt = window.event || arguments[0]; if (evt && evt.keyCode == 13) { if (typeof evt.cancelBubble != "undefined") evt.cancelBubble = true; if (typeof evt.stopPropagation == "function") evt.stopPropagation();      return false; } return true; } </script>  

猜你喜欢

转载自www.cnblogs.com/dengsheng/p/12069393.html