내 양식은 현재 두 개의 이메일 필드가 일치하는지 확인합니다. 두 전자 메일 필드가 비어 있고 확인란이 선택되어 있지 않은지 확인하는 것이 좋습니다. 나는 예제를 위해 수색을하고 있었고 아무것도 트릭을하지 않는 것처럼 보인다.자바 스크립트 양식 유효성 확인 (복수 조건)
도움을 주시면 감사하겠습니다. 오히려 I는 전체 형상 함수로 변경 제언 checkEmail()
기능에 부가보다
<form action="" method="post" name="submission" onsubmit="return checkEmail(this);">
<label for="email">Email</label>
<input id="email" maxlength="55" name="email" type="text" value="<?=htmlspecialchars($_POST["email"]) ?>" /><br/>
<label for="emailconfirm">Confirm email address</label>
<input id="emailconfirm" maxlength="55" name="emailconfirm" type="text" value="<?=htmlspecialchars($_POST["emailconfirm"]) ?>" /><br/>
<label for="checksign">By completing this form, you agree to the terms and conditions above. If you do not agree to these terms, your application will not be considered.</label>
<input class="check" id="checksign" name="checksign[]" type="checkbox" value="Yes" />
</form>
<script type="text/javascript" language="JavaScript">
function checkEmail(theForm) {
if (theForm.email.value != theForm.emailconfirm.value)
{
alert('E-mail addresses do not match.');
return false;
} else {
return true;
}
}
</script>