<intput type="text" onkeydown="Click()"> <script type="text/javascript"> function Click(){ if(event.keyCode == 13){ //按下回车键 //do something } } </script> 或者: <input type="text" onkeydown="if(event.keyCode==13){Click()}"> <script type="text/javascript"> function Click(){ //do something } </script>
原文地址:http://blog.csdn.net/xyw_blog/article/details/40432215