Html code for email validiation_1

<html><head>
<script>
function validateForm()
{
var x=document.forms["myForm"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<=1 || dotpos<atpos+2 || dotpos+2>=x.length)
  {
  alert("Not a valid e-mail address");
  return false;
  }
  else
  {
        alert("valid email"); 
  }
}
</script>
</head>
<body>
<form name="myForm" onSubmit="return validateForm();" method="post">
Email: <input type="text" name="email">
<input type="submit" value="Submit">
*
</form>


</body>

Comments

  1. Thanks for code. Currently i m looking for the email html validation code for my email related work. Now i can easily work through it.

    ReplyDelete

Post a Comment

Popular posts from this blog

Code for Database Connection confirmation PHP+HTML

Database connect with php

New Slides