Company Test put a project backstage in IE browser (360,firefox no problem) data duplication problem, debugging a long time finally found the problem, do not know who wrote the code, drunk ....
Wrong location:
<input type= "Submit" value= "commit" class= "btn" id= "Formsubmit" onclick= "Checkform ()"/>
The type is written in submit, and the form is submitted in Checkform.
Type= "button" and type= "submit" under IE Firefox 360 respectively submit () and Go Ajax test:
Test code:
<Body> <formID= "Form1"Method= "Get" > <inputname= "username"value= "Zhangsan" /><BR> <inputname= "Age"value= " the" /><BR> <inputname= "Address"value= "Beijing" /><BR> <inputname= "Birthday"value= "10-12" /><BR> <inputname= "Contactinfo.tel"value= "13321464327" /><BR> <inputname= "Contactinfo.address"value= "Hebei" /><BR> <inputID= "Subbutton"type= "Submit"value= "Submit"onclick=""/><!--<input id= "Subbutton" type= "button" value= "Submit" onclick= "submit ();" /> - </form> <Scripttype= "Text/javascript"src= "Jquery-1.8.3.js"></Script> <Scripttype= "Text/javascript">$ (document). Ready (function() { $("#subbutton"). Click (function() {$.ajax ({type:"POST", URL:"queryitems.action?name= ' Xuhui '", Data: $ ("#form1"). Serialize (), Async:false, DataType:"JSON", Success:function(data) {}}); }); //function Submit () {//$ ("#form1"). Submit ();// } }); </Script></Body>
Test results:
Type= "Submit"
General Submit:
IE submits form
Firefox submits form one
360 Submit Form One
Ajaxsubmit:
IE
Firefox
The same
Type= "button"
General Submit:
IE One
Firefox One
One
Ajaxsubmit:
IE One
Firefox One
One
Results Analysis:
Type=button is simply a button function
Type=submit is the Send form
But for the Web UI people should be aware that using submit to improve the usability of the page:
After using submit, the page supports keyboard enter operations, while many web software designers may not notice the submit unification.
The page does not support the ENTER key after the button is used. Therefore, you need to support the ENTER key, you must set a submit, the default enter key to the first submit to the page operation.
<input type= "Submit" name= "Submit" value= "submitted" onclick= "Submission ()" >
After executing the onclick, go to action. You can submit automatically without committing in the onclick. So, the onclick here can not be.
Here can explain why the above will be repeated submissions, but the repetition of the situation will only be in IE browser, Firefox and 360 is not, guess should be the form submission is optimized.
<input type= "button" name= "button" value= "commit" onclick= "submit ()" >
After executing the onclick, the jump file is controlled in the JS file. Submit requires onclick.
The bug record in the learning process ...
Duplicate submission of form form, type= "button" and type= "submit" Difference