html代碼: js代碼: ...
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>