Email Validation Using Javascript

by raveendran 2010-01-28 18:51:55

Email Validation Using Javascript


<form name="validation" onSubmit="checkmail()">
Enter email address:
<input type="text" name="email">
<input type="submit" value="Submit">
</form>

<script type="text/javascript">
function checkmail(){
var str=document.validation.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
alert("You have entered valid email address");
else alert("Please Enter a valid email address");
}</script>

Tagged in:

1013
like
0
dislike
0
mail
flag

You must LOGIN to add comments