pwned
08-01-2003, 02:08 PM
I've been writing actionscript for a few years now, but am fairly new to JavaScript
I wrote an email verification form last nite and it seems to be working fairly well locally (unless i hit enter...it only works if i click on submit) But is giving other people all kind of problems.
here is the code
<html><head><title>E.C.</title></head>
<form name="email" onSubmit="checkEmail(); return false;">
<input type="text" name="email1" value="Enter Email Here" onFocus="window.document.email.email1.value=' ';" onBlur="window.document.email.email1.value='Enter Email Here';">
<br>
<input type=submit value=" Submit ">
<input type=reset value=" Reset Form ">
</form>
<script language = "javascript">
function checkEmail()
{
var alertMessage="You've entered an invalid e-mail address";
var alertMessageGood= "Thank You!";
var lowerCase = window.document.email.email1.value.toLowerCase();
var checkAt = lowerCase.indexOf("@");
var checkPer = lowerCase.substring(checkAt + 1, lowerCase.length);
var checkPer2 = checkPer.indexOf(".");
if(window.document.email.email1.value.length < 8){alert(alertMessage + "(length)");}
else if(checkAt == -1) {alert(alertMessage + "(@sign)");}
else if (checkPer2 == -1){alert(alertMessage + "(Period)");}
else if(checkPer.charAt(length - 1) == "."){alert(alertMessage + "(Period)");}
else{alert(alertMessageGood);}
}
</script>
</html>
And here (http://polturk-pad.dyndns.org/java/java25.html) is the link to test it at
If anyone could give me some help with this id be appreciative.
Thanks,
Eric
I wrote an email verification form last nite and it seems to be working fairly well locally (unless i hit enter...it only works if i click on submit) But is giving other people all kind of problems.
here is the code
<html><head><title>E.C.</title></head>
<form name="email" onSubmit="checkEmail(); return false;">
<input type="text" name="email1" value="Enter Email Here" onFocus="window.document.email.email1.value=' ';" onBlur="window.document.email.email1.value='Enter Email Here';">
<br>
<input type=submit value=" Submit ">
<input type=reset value=" Reset Form ">
</form>
<script language = "javascript">
function checkEmail()
{
var alertMessage="You've entered an invalid e-mail address";
var alertMessageGood= "Thank You!";
var lowerCase = window.document.email.email1.value.toLowerCase();
var checkAt = lowerCase.indexOf("@");
var checkPer = lowerCase.substring(checkAt + 1, lowerCase.length);
var checkPer2 = checkPer.indexOf(".");
if(window.document.email.email1.value.length < 8){alert(alertMessage + "(length)");}
else if(checkAt == -1) {alert(alertMessage + "(@sign)");}
else if (checkPer2 == -1){alert(alertMessage + "(Period)");}
else if(checkPer.charAt(length - 1) == "."){alert(alertMessage + "(Period)");}
else{alert(alertMessageGood);}
}
</script>
</html>
And here (http://polturk-pad.dyndns.org/java/java25.html) is the link to test it at
If anyone could give me some help with this id be appreciative.
Thanks,
Eric