zoukankan      html  css  js  c++  java
  • button,input type=button按钮在IE和w3c,firefox浏览器区别

    当在IE浏览器下面时,button标签按钮,input标签type属性为button的按钮是一样的功能,不会对表单进行任何操作。

      但是在W3C浏览器,如Firefox下就需要注意了,button标签按钮会提交表单,而input标签type属性为button不会对表单进行任何操作。

      大爷的啊,由于没有认真看过w3c规范,nnd今天用Firefox测试时尽然执行到了onsubmit事件中,调了半天,原来是在IE和Firefox的表现不同,晕死。。。

      测试代码如下,在IE浏览器下,点击2个按钮都无反应。但是在W3C浏览器,如Firefox,google的chrome,点击button标签按钮会执行到onsubmit事件中。

    <!DOCTYPE html>
    <html>
    <head>
    <title>button,input type=button按钮在IE和w3c,firefox浏览器区别</title>
    <script type="text/javascript">
        function ck() {alert('表单提交判断代码!'); return false;}
    </script> 
    </head>
    <body>
    <form onsubmit="return ck()" method="post">
    <input type="button" value="input标签type为button的按钮" /> <button>button标签按钮</button> 
    </form>
    </body>
    </html>

    如果这篇文章对您有帮助,您可以打赏我

    技术交流QQ群:15129679

  • 相关阅读:
    toj 2819 Travel
    toj 2807 Number Sort
    zoj 2818 Prairie dogs IV
    zoj 1276 Optimal Array Multiplication Sequence
    toj 2802 Tom's Game
    toj 2798 Farey Sequence
    toj 2815 Searching Problem
    toj 2806 Replace Words
    toj 2794 Bus
    css截取字符
  • 原文地址:https://www.cnblogs.com/yeminglong/p/2662051.html
Copyright © 2011-2022 走看看