Saturday, 13 July 2013

progam in html to create an email validation form

<html>
    <head>
        <title> email</title>
<script>
    function validate()
 {
 var x=form.emailid.value;
 var atpos=x.indexOf("@");
 var dotpos=x.indexOf(".");
 if(!(atpos>0 && atpos<dotpos))
     {
         alert("not a valid email");
     }
     else
         {
             alert("valid");
     
         }
 }
 </script>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
   <form name="form" onsubmit="validate()">
 <table border="2">
 <tr><td>email</td>
  <td><input type="text" name="emailid">
  </td><tr><br>
 <tr><td>password:</td><td>                        
<input type="password" name="password">
 </td></tr><br>
 </table>           
 <input type="submit" value="submit">           
</form>
</body>
</html>

OUTPUT
email


email
password:

No comments:

Post a Comment