【发布时间】:2020-06-06 06:29:04
【问题描述】:
我有一个名为“audit-form”的网络表单,它有一列我们必须在其中输入观察次数。
<form id="audit-form" action="action.php" method="post">
<label for="observ_count">Number of Observations</label>
<textarea id="observ_count" name="Number_of_Obsevations"></textarea>
<input type="submit" value="Add Obsevations" id="audit_form_submit"/>
</form>
<script>
const auditForm=document.getElementById("audit_form");
const auditButton=document.getElementById("audit_form_submit");
auditButton.addEventListener("click",(e) => {
e.preventDefault();
var noo = auditForm.Number_of_Observations.value;
for(i=0;i<noo;i++)
{
if(i<noo-1)
{
window.location.assign('observ.html'); //html page to enter obsevations and next button at bottom
}
else
{
window.location.assign('observ1.html'); //html page to enter obsevations and submit button at bottom
}
}
});
</script>
我尝试这样做,但直接打开的是 observ1.html 而不是 observ.html 请帮忙
【问题讨论】:
-
“我试图这样做......”。你试图做什么?这段代码的期望行为是什么?请在您的帖子中更详细地包含您的问题描述。目前尚不清楚您的目标是什么。
-
我用非常简单的术语提到了它。我尝试了这个逻辑,但它没有按照我想要的方式工作。你能帮帮我吗?
标签: javascript html webforms