EMail Check
Emailadresse mit JavaScript überprüfen
|
Script: |
<html>
<head>
<script language="JavaScript">
function regexmail(mail) {
var regexist = false;
var res = false;
if(typeof(RegExp) == 'function') {
var testregex = new RegExp('abc');
if(testregex.test('abc') == true) {
regexist = true;
}
}
if(regexist == true) {
reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)(\\@)([a-zA-Z0-9\\-\\.]+)(\\.)([a-zA-Z]{2,4})$');
res = (reg.test(mail));
} else {
res = (mail.search('@') >= 1 && mail.lastIndexOf('.')
> mail.search('@') && mail.lastIndexOf('.') >=
mail.length-5)
}
return(res);
}
function CheckMail() {
document.formular.mailcheck.value =
regexmail(document.formular.mailaddr.value);
}
</script>
</head>
<body>
<form name=formular>
Eingabe: <input type="text" name=mailaddr />
<input type="submit" onSunbmit="javascript:CheckMail()"
/>
<input type="hidden" name=mailcheck />
</form>
</body>
</html>
|
|