Look at this example of how it can be done in Javascript:
<html>
<head>
<script type="text/javascript">
<!--
function validateEmail() {
var emailText = document.getElementById('email').value;
var pattern = /^[a-zA-Z0-9\-_]+(\.[a-zA-Z0-9\-_]+)*@[a-z0-9]+(\-[a-z0-9]+)*(\.[a-z0-9]+(\-[a-z0-9]+)*)*\.[a-z]{2,4}$/;
if (pattern.test(emailText)) {
return true;
} else {
alert('Bad email address: ' + emailText);
return false;
}
}
window.onload = function() {
document.getElementById('email_form').onsubmit = validateEmail;
}
</script>
</head>
<body>
<form id="email_form">
<input type="text" id="email">
<input type="submit">
</form>
</body>
</html>
www.accordsoft.co.in
Gaddad, if this helps please login to Mark As Answer. | Alert Moderator