<script> //回车事件 onkeydown:点击键盘 document.onkeydown=function myAction(){ //网页内按下回车触发 if(event.keyCode==13)//keycode代表键盘按钮的代码 13是enter是代码 { document.getElementById("search").click();//search:要调用的方法 return false; } } </script>
文章来源: https://blog.csdn.net/Crimson1/article/details/90642927