A blog where you can find tutorials on ASP.Net, Ajax Control Toolkit, SQL Server 2008/2005, WCF, Silverlight, Azure and other Microsoft Technologies
Thursday 3 April 2008
Validating E-Mail Address Using JavaScript Regular Expression:
In this Post I will tell you how to Validate E-Mail address format using javascript regular expression
function ValidateEmail()
{
var EmaiAddress=document.getElementById("txtemail").value;
var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/;
if (!RegExEmail.test(EmaiAddress))
{
alert("Please Enter Valid E-mail Adress");
}
else
{
alert("Go Ahead!");
}
}
All i have done in above code is Call ValidateEmail function on click of a Button named Checkit! and check value in text element. to call function write onclick="ValidateEmail()" in attribute of button element
Subscribe to:
Posts (Atom)