java4all@1986 java. Powered by Blogger.

JavaScript for Email Validation?

>> Friday, June 17, 2011


                                                                Email Validation:
Email VAlidation.
    



<html>
<title>EmailValidation</title>
<head>
<script type="text/javascript">
function CheckEmail(f1) {
email = document.f1.emaill.value
AtPos = email.indexOf("@")
StopPos = email.lastIndexOf(".")
Message = ""

if (email == "") {
Message = "Not a valid Email address" + "\n"
alert("Not a valid Email address" + "\n");
document.write("not a gmail");
}

if (AtPos == -1 || StopPos == -1) {
Message = "Not a valid email address"
alert("Not a valid email address");
document.write("chech ur mail id");
}

if (StopPos < AtPos) {
Message = "Not a valid email address"
alert("Not a valid email address");
document.write("not a valid email");
}

if (StopPos - AtPos == 1) {
Message = "Not a valid email address"
alert("Not a valid email address");
document.write("missing .in email");
}

return false;
}
</script>
</head>
<body>
<form method="post" name="f1">
Email:<input type="text" name="emaill"/>
<input type="submit" onclick="CheckEmail(f1);return false;" value="submit"></input>
</body>
</html>


0 comments:

Post a Comment

FaceBook Login

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

Total Pageviews

STATCOUNTER

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP