Today, due to project requirements, js is needed to control the submission of the form and verify and process the data before submitting.![]() The html code is as follows : Copy code The code is as follows:<div class="test-ft"> <h3 class="shouji">Mobile phone number luck</h3> <form needcheck="1" method="post" target="_blank" action="http://www.go108.com.cn/go108_mobile_free_sz.php"> <p> ... </p> <button class="btn-act">Test now</button> </form> </div> After the coding was completed, a problem occurred during the browser compatibility test: clicking the button did not respond in IE6 and IE7, and the specified URL could not be jumped, but other browsers could jump normally. I always thought there was a problem in the js control code, so I tracked and debugged it for a long time, but I still couldn't find the problem. Later, I found that the button did not specify type as submit, so I suspected that this was the problem. After changing the type attribute of the added button to submit, the function works normally in IE6 and IE7. I have never paid attention to such problems in the past and fell into a trap, so I went to search for information to verify. w3shool has a detailed description of the button type attribute : https://www.jb51.net/w3school/tags/att_button_type.htm Copy code The code is as follows:Definition and Usage The type attribute specifies the type of button. Tip: Always specify a type attribute for buttons. The default type for Internet Explorer is "button", while the default in other browsers (including the W3C specification) is "submit". It can be seen that in other browsers, the form will be submitted after the button is clicked by default, while in IE, the form is not submitted after clicking by default. The default value of type is also a browser compatibility issue, so mark it. |
<<: Introduction to JavaScript conditional access attributes and arrow functions
>>: A brief understanding of the relevant locks in MySQL
npm installation tutorial: 1. Download the Node.j...
Table of contents 1. Basic understanding of React...
1. Modify 1 column update student s, city c set s...
In actual development or production environments,...
Keepalived installation: cd <keepalived_source...
Tab bar: Click different tabs to display differen...
Preface Whether it is a stand-alone lock or a dis...
1. Introduction It has been supported since versi...
We usually have a scanning box when we open the c...
Because the docker daemon needs to bind to the ho...
as follows: -m, --memory Memory limit, the format...
1. Why do packaging? Facilitates overall code cal...
This article uses examples to illustrate the func...
Table of contents Table/index.js Table/model/inde...
It’s great to use CSS to realize various graphics...