html5 输入框响应enter按键

code

<html>
    <body>
     
    <input onkeydown="if(event.keyCode==13) {test()}"/>
     
    <script>
        function test() {
           alert(123);
        }
    </script>
     
    </body>
 </html>

原文地址:https://www.cnblogs.com/sea-stream/p/13530623.html