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
The system environment is server2012 1. Download ...
Overview When a 500 or 502 error occurs during ac...
Preface The similarities and differences between ...
This article example shares the specific code of ...
Negative distance refers to empathy. Preface (rai...
background As we all know, after we develop a Jav...
Table of contents Preface text 1. Concepts relate...
Code: <input type="text" class="...
mysql id starts from 1 and increases automaticall...
Borrowing Constructors The basic idea of this t...
Table of contents 1. Live broadcast effect 2. Ste...
There are always some problems when configuring n...
The content attribute is generally used in the ::...
I have a product parts table like this: part part...
1. Create a page using app.json According to our ...