Due to project requirements, the submission of the js control form is required. data verification and processing are performed before the submit. The buttons in ie6 and ie7 are not reflected, and the specified url cannot be redirected, other browsers can jump normally and always think that there is a problem in the js control code, so the tracing and debugging has not been found for a long time. Later, it was found that the button did not specify the type as submit. Due to project requirements today, JavaScript needs to control form submission, and data verification and processing will be performed before submit.
The html code is as follows::
The Code is as follows:
Mobile phone number
After encoding is complete, the compatibility test of the browser has encountered a problem: ie6 or ie7 does not reflect the button, and the specified url cannot be redirected, but other browsers can jump normally.
I always thought that there was a problem in the js control code, so I have been tracking and debugging for a long time and have never found any problems. Later, we found that the type of the button is not specified as submit, So we suspect that this problem is true.
After the type attribute of the added button is changed to submit, ie6 and ie7 functions normally.
I have never paid attention to such a problem in the past, so I went to search for materials for verification.
The type attribute of the button is described in detail on w3shool.:
Http://www.jb51.net/w3school/tags/att_button_type.htm
The Code is as follows:
Define and use the type property to specify the type of the button. Tip: always define the type attribute for the button. The default type of Internet Explorer is "button", while that of other browsers (including W3C specifications) is "submit ". It can be seen that the form will be submitted after the default button is clicked in other browsers, while the form will not be submitted after ie click by default. The default value of type is also a browser compatibility problem, so mark.