Home  >  Article  >  Web Front-end  >  The button does not specify type as submit. Clicking the button does not jump to the specified url_HTML/Xhtml_Webpage Production

The button does not specify type as submit. Clicking the button does not jump to the specified url_HTML/Xhtml_Webpage Production

WBOY
WBOYOriginal
2016-05-16 16:40:281835browse

Today, due to project requirements, js is required to control the submission of the form, and verify and process the data before submitting.

html code is as follows:

Copy code
code As follows:


Mobile phone number is bad luck


< form needcheck="1" method="post" target="_blank" action="http://www.go108.com.cn/go108_mobile_free_sz.php">


...






After the coding was completed, a problem occurred during the browser compatibility test: clicking the button under IE6 and IE7 did not reflect the response, 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 no problem was found. Later, I found that the button did not specify type as submit, so I wondered if this was the problem.
After modifying the type attribute of the added button to submit, the function works normally under ie6 and ie7.

I have never paid attention to this problem in the past, and I fell into a trap, so I searched for information to verify it.
w3shool has a detailed description of the type attribute of button:
http://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 the type attribute for buttons. The default type in Internet Explorer is "button", while the default in other browsers (including the W3C specification) is "submit". It can be seen that the default button in other browsers will submit the form after being clicked, but IE will not submit the form after being clicked by default. The default value of type is also a browser compatibility issue, so mark it.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn