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

SOLID Principles with C#

Overview of MVC

Auto Sequence Number in Grid Control with Paging

Send Email using Gmail SMTP server - ASP.NET

Applying Dynamic Themes to WebPage

MVC Request Execution Stages - Life Cycle

Parsing the comma separated values into a temporary table

Introduction to ASP.Net MVC

Differences between a Structure and Class