为什么form.submit()不工作? [英] Why is form.submit() not working?
问题描述
我在页面中有以下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屋!