Button, input type = button in IE, W3C, Firefox browser difference

Source: Internet
Author: User

In IE browser, the button with the "button" Property of "input tag type" is the same and does not perform any operations on the form.

However, in W3C browsers, such as Firefox, You need to note that the button label button will submit the form, and the type attribute of the input label is "button" will not perform any operation on the form.

Dear Lord, since I have not carefully read the W3C specification, nnd ran the onsubmit event during the Firefox test today. After half a day, it turned out to be different in IE and Firefox, dizzy...

TestCodeAs shown in the following figure, no response is returned when two buttons are clicked in IE. However, in W3C browsers such as Firefox and Google Chrome, clicking the button tag will execute the onsubmit event.

 <!  Doctype html  >  <  Html  >  <  Head  >  < Title  > Button, input type = button in IE, W3C, Firefox browser difference </  Title  >  <  Script  Type  = "Text/JavaScript"  >      Function  CK () {alert (  '  Form submission judgment code! '  );  Return   False  ;}  </  Script  >   </  Head  >  <  Body  >  < Form  Onsubmit  = "Return CK ()"  Method  = "Post"  >  <  Input  Type  = "Button"  Value  = "Button with input tag type as button"   />  <  Button  > Button</  Button  >  </  Form  >  </  Body  >  </  Html  > 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.