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>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-25
  • 2021-09-13
  • 2021-10-28
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案