jQuery验证表单电子邮件地址的有效性

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<!-- jQuery: Validating an email. -->

$('#txtEmail').blur(function(e) {

var sEmail = $('#txtEmail').val();

if ($.trim(sEmail).length == 0) {

alert('Enter valid Email ID');

e.preventDefault();

}        

var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]

{2,4}|[0-9]{1,3})(\]?)$/;        

if (filter.test(sEmail)) {

alert('Valid Email');

}

 else {

alert('Email not valid');

 e.preventDefault();

}

});

<!-- HTML: Validating an email-->

<asp:TextBox id="txtEmail" runat="server" />