<script>
function Validation(){
var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
str = document.getElementById('txtemail').value;
if(str.match(emailRegEx)) {
alert(str+' is valid email id.');
return true;
}
else {
alert(str+' is invalid email address.');
return false;
}
}
</script>
************************
<html>
<body>
<form name="frm" method="post" action="#" onsubmit="return Validation();">
Enter your email id:
<input type="text" name="txtemail" id="txtemail" />
<input type="submit" name="submit" value="Check"/>
</form>
</body>
</html>
[ add comment ] ( 1 view ) | permalink |




( 3.8 / 24 )
Calendar



