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

Auto Refresh .aspx page - ASP.NET

Overview of MVC

SOLID Principles with C#

MVC Request Execution Stages - Life Cycle

Page Life Cycle in ASP.NET

Auto Sequence Number in Grid Control with Paging

Applying Dynamic Themes to WebPage

SQL Server 2005 with XML Parameters

How to Update Dependent Excel Cells Automatically