나는 보통 내 문제를 해결할 수있는 정보가 가득한이 장소에서 질문하지 않습니다. 그러나, 나는 PHP, Javascript 등등에 익숙하지 않다. 그리고 나는 단지 내가 가지고있는이 문제를 파악하는 것처럼 보이지 않는다. 그래서 나는 너희들을 돌보고 도움에 크게 감사 할 것이다.자바 스크립트 전자 메일 유효성 검사
그래서 필자는 전자 메일의 유효성을 검사하는 Javascript 기능으로 작성하려고했지만 동료와 의견 시스템을 가지고 놀고 있습니다. 여기에 다음과 같이 코드 ...
$(function() {
//alert(event.timeStamp);
$('.new-com-bt').click(function (event) {
$(this).hide();
$('.new-com-cnt').show();
$('#name-com').focus();
});
/* when start writing the comment activate the "add" button */
$('.the-new-com').bind('input propertychange', function() {
$(".bt-add-com").css({
opacity: 0.6
});
var checklength = $(this).val().length;
if (checklength) {
$(".bt-add-com").css({
opacity: 1
});
}
});
/* on clic on the cancel button */
$('.bt-cancel-com').click(function() {
$('.the-new-com').val('');
$('.new-com-cnt').fadeOut('fast', function() {
$('.new-com-bt').fadeIn('fast');
});
});
// on post comment click
$('.bt-add-com').click(function() {
var theCom = $('.the-new-com');
var theName = $('#name-com');
var theMail = $('#mail-com');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9] {2,4})+$/;
if (!theCom.val()) {
alert('oh! Don`t forget your message!');
}
if (!filter.test(theMail.value)) {
alert('Please provide a vaild email address');
theMail.focus;
return false;
} else {
$.ajax({
type: "POST",
url: "ajax/add-comment.php",
data: 'act=add-com&id_post=' + <? php echo $id_post; ? > +'&name=' + theName.val() + '&email=' + theMail.val() + '&comment=' + theCom.val(),
success : function (html) {
theCom.val('');
theMail.val('');
theName.val('');
$('.new-com-cnt').hide('fast', function() {
$('.new-com-bt').show('fast');
$('.new-com-bt').before(html);
})
}
});
}
});
});
당신은 내가 var에 필터 등을 제공 참조 ...하지만 간단한 용어로 설명하는 바와 같이이며, 최종 결과는 이메일이 유효하지만 때 말을 경고 것이다 유효한 전자 메일을 입력하고 제출하려고하면 경고와 최종 결과가 나오더라도 문제가 발생하지 않습니다.
죄송합니다.이 문제에 대해 거의 알지 못하거나 미처 알지 못해서 죄송합니다. 어쨌든 도움을 드릴 수 있습니다.
다시 도움이 될 것입니다.
감사합니다.