关于 "Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function" 的解决方案

今天遇到了一坑爹问题,发现外国网站上也有好多人在问,居然有人怀疑这是一个不为人知的bug。。

见代码:

<input type="button" name="submit" onclick="xxx()" />
<script type="text/javascript">
xxx(){ form.submit(); }
</script>

如果点提交的话,会有这样的报错:

"Uncaught TypeError: Property 'submit' of object #<HTMLFormElement> is not a function"

其实呢,其实呢。。这一切都是因为你type写了button,name写了submit的原因,把name改成button就ok了~~  

这样的话在xxx()里写form.submit()就不会报错了

posted @ 2012-08-29 16:14  逸の尘  阅读(1064)  评论(0)    收藏  举报