如何根据特定条件提交表单? [英] How to submit form based on certain condition?
本文介绍了如何根据特定条件提交表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< div id =form-containerstyle =padding-top:10px; padding-bottom:10px;>
var x = Math.random();;
if(x> 0.5)
{
submit form
}
如何根据x值自动提交表单?这意味着按钮应该自动按下。
解决方案
document.getElementById('theForm')。submit();
I have one form data.php with following form structure.
<div id="form-container" style="padding-top: 10px; padding-bottom: 10px;">
var x=Math.random();;
if(x > 0.5)
{
submit form
}
<p style="width: 100%; text-align: right;"><button type="button" id="submit-button">Sumit</button></p>
How form can be automatically submitted based on x value? Which means button should be pressed automatically.
解决方案
document.getElementById('theForm').submit();
这篇关于如何根据特定条件提交表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文