Hi the following code should help although you should really do this with some sort off server side codeto stop people being able to register with javascript turned off.
Code:
<script type="text/javascript" charset="utf-8">
var FormCheck = {
Init : function(){
//replace 'formname' with your form name
document.getElementById('formname').onsubmit = function(){
//change 'email' to the name off your email field
if(!FormCheck.CheckEmail(document.getElementById('email').value)){
alert("email address not valid");
return false;
}
};
},
CheckEmail : function(email){
var re = new RegExp(/^.*\.edu(\.\D{2})?$/);
return email.match(re) ? true : false;
}
};
window.onload = function(){
FormCheck.Init();
}
</script>
Bookmarks