表单提交(四)——不能提交表单


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"方法不影响。

posted @ 2014-08-12 14:42  xjinza  阅读(308)  评论(0编辑  收藏  举报