Email Validation by Javascript

function EmailCheck()
{
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var str =document.getElementById('<%= TxtTo.ClientID %>').value;

if(reg.test(str) == false)
{
alert('Invalid Email Address');
document.getElementById('<%= TxtTo.ClientID %>').focus();
}
}

Comments

Popular posts from this blog

Overview of MVC

SOLID Principles with C#

Page Life Cycle in ASP.NET

How to Edit More than 200 Rows in SQL Server 2008

Differences between a Structure and Class

MVC Request Execution Stages - Life Cycle

Auto Sequence Number in Grid Control with Paging

ASP.NET MVC Version History

Print Function By JavaScript