我在下面调用了javascript函数
function formOnSubmit() {
if (document.forms[0].ref_no.value == "") {
if (document.forms[0].acc_code.value == "") {
if (document.forms[0].vendor_code.value == "") {
if (document.forms[0].acc_service_tax.value == "") {
if (document.forms[0].acc_doc_name.value == "") {
alert('Please enter atleast one attribute value');
return false;
}
}
}
}
} else {
return true;
document.forms[0].submit();
}
}
其中,ref_no,acc_code,vendor_code,acc_service_tax,acc_doc_name 是文本框
问题是当我在 ref_no texbox 中输入某些内容时,表单被提交了两次,而其余文本框的表单提交了一次。
我想知道为什么输入 ref_no 值时表单会提交两次。