html代码:
<form action="/test/action" method="get" id="myForm"> <p>First name: <input type="text" name="fname" /></p> <p>Last name: <input type="text" name="lname" /></p> <input type="button" οnclick="formSubmit()" value="提交" /> </form>
js代码:
<script> function formSubmit() { // 提交表单 document.getElementById("myForm").submit(); } </script>