如何自动提交数据html表单? [英] How to autosubmit data html form?
本文介绍了如何自动提交数据html表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个简单的表单:
I have this simple form:
<form ENCTYPE="multipart/form-data" action="story.php" method="POST">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>
我用外部iframe和javascript填充querystring参数的value。
好的。现在我需要将这些数据发送到一个php文件。
我的想法是去autosubmit。
现在我可以使用像显示文件这样的按钮来做到这一点,但我不需要按钮,而是自动发送值的东西。
是否有可能这样做?
I fill the "value" with a querystring parameter by external iframe and javascript. Ok. Now I need to send this data to a php file. My idea was go for autosubmit. Now I can do that with a button like "show files", but I dont need a button but something that send the value automatically. Is it possible do that?
推荐答案
调用一个提交表单的JS代码,输入。
Call a this JS code that submits the form after you set the value of the input.
document.getElementById("storyForm").submit();
HTML:
HTML:
<form ENCTYPE="multipart/form-data" action="story.php" method="POST" id="storyForm">
<input type="submit" value="Show files">
<input type="hidden" name="emailp" id="emailp" value="">
</form>
这篇关于如何自动提交数据html表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文