通过JS代码提交(submit)表单
程序员文章站
2022-03-29 10:08:57
...
通过JS代码提交(submit)表单,将提交按钮的类型设置为普通button,然后添加onclick属性
<!DOCTYPE html> <html> <head> <script> function formSubmit() { document.getElementById("frm1").submit(); } </script> </head> <body> <p>Enter some text in the fields below, then press the "Submit form" button to submit the form.</p> <form id="frm1" action="form_action.asp"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br><br> <input type="button" onclick="formSubmit()" value="Submit form"> </form> </body> </html>
更多通过JS代码提交(submit)表单相关文章请关注PHP中文网!
上一篇: php中魔术方法的说明