例如,假设我有这两种形式
<form method="post" action="/lorum/ipsum/dolor/sit/amet">
<!-- Some stuff -->
</form>
<form method="post" action="some/other/location/here">
<!-- Some stuff -->
</form>
<button> </button> <!-- this is going to submitboth forms
我希望这是有道理的
类似的东西有效:
document.getElementById("submit").onclick = function() {
document.getElementById("form1").submit();
document.getElementById("form2").submit();
}
<form id="form1" method="post" action="/lorum/ipsum/dolor/sit/amet">
<!-- Some stuff -->
</form>
<form id="form2" method="post" action="some/other/location/here">
<!-- Some stuff -->
</form>
<button id="submit">Submit forms</button>
我不知道如何测试它,但如果找到的话我会尝试更新我的代码片段。 :)
希望能帮助到你。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)