zoukankan      html  css  js  c++  java
  • 表单提交(四)——不能提交表单


    Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint.——jquery API

         表单和其子元素不能用一个表单的属性作为name或id的名称,如submit, length, or method,会产生冲突。从而导致表单提交失败。Chorme中报错:Uncaught TypeError: object is not a function

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <script type="text/javascript">
            function formSubmit()
            {
    
                document.getElementById("myForm").submit();
    
    
            }
        </script>
    </head>
    
    <body>
    
    <form id="myForm" action="http://www.baidu.com" method="get" >
        姓名:<input type="text" name="name" size="20"><br />
    
        <input type="button" onclick="formSubmit()" name="submit" id="submit" value="提交">
    </form>
    </body>
    
    </html>

     用type="submit"方法不影响。

  • 相关阅读:
    Javaoop_继承
    事务,视图,索引,备份和恢复
    常用函数。
    为虚拟机配置NAT网络
    安装Linux系统
    初始Redis
    高内聚低耦合
    MyBatis动态SQL
    初始MyBatis
    GitHub的操作
  • 原文地址:https://www.cnblogs.com/xjinza/p/3907273.html
Copyright © 2011-2022 走看看