ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Life >

[JS]How to submit to two forms at once

Friday on June 10th, 2005Life

A way to submit to two forms at once!

First define a javascript function mylogin()

function mylogin() {formerr=false;if(document.login.username.value.length<1)formerr= Please fill in your username!& quot;;if(document.login.pwhidden.value.length<1)formerr= Please enter your password!& quot;;if (formerr) {alert(formerr);return false;} else {document.login2.username.value=document.login.username.value;document.login2.password.value=document.login.pwhidden.value;document.login2.savepass.value=document.login.savepass.value;document.login2.submit();return true;}}

Then define two forms, the first name is login, the second login2, add onSubmit="return mylogin()" to the first form, and the input types of the second form are all hidden, so that you can submit two forms at once.

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/life/JS-How-to-submit-to-two-forms-at-once.htm