且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

单个HTML表单中的多个提交按钮

更新时间:2021-11-02 10:02:22

不使用提交.

即, 不要使用<input type="submit">

而是制作两个单独的按钮,并在onclick上调用不同的功能.请注意,您仍然可以获取表单值.

Instead make two separate buttons and call different functions onclick. Mind that you can still get the form values.

<button onclick="return reqfunc()">

使用return,现在您可以使用该功能了.如果您想返回表格而不返回下一页,则只需在JavaScript中点击return false.

use return , and now you can use the function. if you want to return to the form back without going to the next page then just return false in the javascript.