为什么form.submit()不工作? [英] Why is form.submit() not working?

查看:98
本文介绍了为什么form.submit()不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面中有以下snipet。我不能为了我的生活找出为什么表单在点击button1元素时没有提交。我在IE中遇到一个错误,该对象不支持这个属性或方法。我把document.poform放在一个alert中,它会提醒一个表单对象。我感觉我失去了一些超级明显的东西 -

 < pre> 
<?
var_dump($ _ POST);
?>
< / pre>
< form action =method =postname =poform>
< input name =testtype =text/>
< input name =buttontype =buttonvalue =button1onclick =document.poform.submit(); />
< input name =submittype =submitvalue =button2/>
< / form>


解决方案

既然您有< ;输入> 命名为提交 document.poform.submit 就是< input> ,而不是 submit()方法。 使用 一个不同的名字。


I have the following snipet in a page. I cannot for the life of me figure out why the form is not submitting when clicking the button1 element. I get an error in IE syaing that this object does not support this property or method. I put the document.poform in an alert, and it alerts a form object. I get the feeling that I am missing something super obvious maybe??

<pre>
<?
    var_dump($_POST);
?>
</pre>
<form action="" method="post" name="poform">
    <input name="test" type="text" />
    <input name="button" type="button" value="button1" onclick="document.poform.submit();" />
    <input name="submit" type="submit" value="button2" />
</form>

解决方案

Since you have an <input> named submit, document.poform.submit is that <input>, not the submit() method.

Use a different name.

这篇关于为什么form.submit()不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆