View Full Version : Formvalidation: Emailaddress must be from domain @domain.xx
N!cklas
08-30-2002, 12:59 AM
Could anyone plz help me with a script that only let people register if they have a @domain.xx emailaccount?? I've found a small piece at JavascriptKit (http://www.javascriptkit.com/script/script2/acheck.shtml) that validates any extensions. I just don't understand how to only allow @domain.xx....
/N!cklas
whammy
08-30-2002, 10:23 AM
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function validatedomain(x){
var parts = x.split("@") ;
if(parts[1]!="domain.xx"){
alert('Boo!');
return false;
}
else{
alert('Yay!');
return true;
}
}
// -->
</script>
</head>
<body>
<form name="blah" action="javascript://" method="post" onsubmit="return validatedomain(this.email.value)">
<input type="text" name="email" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
N!cklas
08-31-2002, 03:07 PM
Thanx!! Just what i needed :thumbsup:
whammy
09-01-2002, 03:28 AM
:cool:
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.