This is javascript code, needs to be added to html:
<script>
function validate(form_id,email_address) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.forms[form_id].elements.email_address].value;
if(reg.test(address) == false) {
alert(‘Please, enter correct email’);
return false;
}
}
</script>

And this is form html code
<form id=”form_id” method=”post” action=”your_some_file.php” onsubmit=”javascript:return validate(‘form_id’,’email’);”>
<input type=”text” id=”email” name=”email” />
<input type=”submit” value=”Submit” />
</form>

Useful links: http://www.smartwebby.com/dhtml, http://www.white-hat-web-design.co.uk/articles

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

required