嗨,我有这段代码来验证可正常使用的表单,但是如果表单有效,它不会执行else语句并直接转到页面
function printpage() {
if (!mandatoryText(document.getElementById('FIRSTNAME_FIELD'), 'First name')) return false;
if (!mandatoryText(document.getElementById('LASTNAME_FIELD'), 'Last name')) return false;
if (!mandatoryText(document.getElementById('ZIP_CODE_FIELD'), 'Post code')) return false;
if (!mandatoryText(document.getElementById('EMAIL_FIELD'), 'Email')) return false;
if (!isEmail(document.getElementById('EMAIL_FIELD'))) return false;
if (!isDateOK(document.getElementById('LAST_SHOWROOM_VISIT_FIELD').value)) return false;
if (document.getElementById('LAST_SHOWROOM_VISIT_FIELD').value != '') modifyDateFormat(document.getElementById('LAST_SHOWROOM_VISIT_FIELD'));
document.getElementById('emvForm').submit();
if (document.getElementById('LAST_SHOWROOM_VISIT_FIELD').value != '') modifyDateFormat(document.getElementById('LAST_SHOWROOM_VISIT_FIELD'));
else {
return true;
var p1 = document.getElementById('SELECTED_PRODUCT_1_FIELD').value;
window.location.href = "summary.html?" + "p1" + "=" + p1;
}
}