JavaScript email Validation :
It is the simple code to help you in creating a form with email validation using regular expression.<html>
<head>
<title>JavaScript form validation Using regular expression</title>
<script type= "text/javascript">
function Validate(input)
{
var format = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(document.getElementById("email").value.match(format))
{
document.myform.email.focus();
return true;
}
else
{
alert("You have entered an wrong email address!");
document.myform.email.focus();
return false;
}
}
</script>
</head>
<body>
<h2>Input an email and Submit</h2>
<form name="myform" action="#">
<input type='text' name='email' id="email"/>
<input type="submit" name="submit" value="Submit" onclick="Validate(document.myform.email)"/>
</form>
</body>
</html>
Nice ...
ReplyDeleteThanks...
DeleteThis mehod nice working
ReplyDeleteThanks
ReplyDeletei like this script very much thanks
ReplyDeletethis is my email id:[email protected]
please send me useful script such as above .thanks again.
Thanks...You can follow our Facebook page Php Tutorials For Beginners, so you get updated whenever new content added to the blog.
Deletethanks its work exactly
ReplyDeletethank u, its working.....
ReplyDeleteHi and tnx for sharing this code. But i have still problem to Check the length of the domain name.
ReplyDelete