Transferred from: http://baiying.blog.51cto.com/1068039/1319784
There are two types of HTML buttons:
<input type= "button" value= "Login" onclick= "login ()"/>
and <button onclick= "login ()" > Login </button>
The two seem to look the same on the page, but there are differences between the two types.
1, if in <form id= "LoginForm" name= "LoginForm" action= "<%=path%>/hdlogin/login.action" method= "POST" ></ Form>
tab, use <input type= "button" value= "Login" onclick= "login ()"/> to submit a form,
You must write <input type= "submit" value= "Login" onclick= "login ()"/>
or Document.loginForm.submit (), otherwise the form will not be submitted.
2, if you use <button onclick= "login ()" In form > Login </button> just click to submit.
<button type= "Submit" value= "Login" onclick= "login ()"/>.
Today in the use of <button></button>, I again in the JS control form submission, the result of this action is always inexplicably walk two times!
The root cause is that the form was submitted two times, one <button></button> one is Document.loginForm.submit ();
This mistake is very covert, we should pay attention to it later.