Monday, April 28, 2008

How To Validate Email Id Using JavaScript

<html>
<head>
<script>
String.prototype.ValidateEmail = function (evt)
{
var eVal = new RegExp("\\w+([-+.\’]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
var chkVal = eVal.exec(this);
if(chkVal != null)
{
alert('Id Correct');
}
else
{
alert('Check Your Id');
}
</script>
</head>
<body>
<input type="text" id="txtEmail" width="30px" onblur="this.value.ValidateEmail();" />
</body>
</html>
ProgramDemo



No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.