Advertisement
Guest User

developmentweb1

a guest
Jul 5th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.38 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <title >Registration Form</title>
  4. <script>
  5. function validateForm()
  6. {
  7.   var x=document.forms["myForm"]["fname"].value;
  8.   if(x==null || x=="")
  9.     {
  10.     alert("First Name must be Filled");
  11.     return false;
  12.     }
  13. }
  14.  
  15. function validateEmail(sEmail)
  16.  {
  17.         var reEmail = /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/;
  18.  
  19.     if(!sEmail.match(reEmail))
  20.      {
  21.         alert("Invalid email address");
  22.         return false;
  23.     }  
  24. }
  25.  
  26.  
  27. function validatePhone(sPhone) {
  28.        
  29.         var phoneno = /^\d{10}$/;
  30.        
  31.         if(!sPhone.match(phoneno)) {
  32.             alert("Invalid Mobile Number.");
  33.             return false;
  34.         }  
  35.     }      
  36.  
  37.  
  38. </script>
  39. </head>
  40. <body >
  41. <H1 align="center">Registration Form</H1>
  42.  
  43. <table " border="1" align="center">
  44. <col width="300"/>
  45. <col width="200"/>
  46. <form name="myForm" action="demo.html" onsubmit="return validateForm()" method="post">
  47.  
  48. <tr>
  49. <td>
  50. <b><font color="#00008B" size="4">Enter Username</font></b>
  51. </td>
  52. <td>
  53. <input type="text"/>
  54. </td>
  55. </tr>
  56.  
  57.  
  58. <tr>
  59. <td>
  60. <b><font color="#00008B" size="4">Enter Password</font><b>
  61. </td>
  62. <td>
  63. <input type="password" name="pwd"/>
  64. </td>
  65. </tr>
  66.  
  67. <tr>
  68. <td>
  69. <b><font color="#00008B" size="4">Confirm Password</font></b>
  70. </td>
  71. <td>
  72. <input type="text" name="cpwd"/>
  73. </td>
  74. </tr>
  75.  
  76.  
  77. <tr>
  78. <td>
  79. <b><font color="#00008B" size="4">First Name</font></b>
  80. </td>
  81. <td>
  82. <input type="text" name="fname">
  83. <tr>
  84.  
  85.  
  86. <td>
  87. <b><font color="#00008B" size="4">Lasr Name</font></b>
  88. </td>
  89. <td>
  90. <input type="text"/>
  91. </td>
  92. </tr>
  93.  
  94. <tr>
  95. <td><b><font color="#00008B" size="4">Email-Id</font></b></td>
  96. <td><input type="email" onblur="validateEmail(this.value)"/></td>
  97.  
  98.  
  99. <tr>
  100. <td>
  101. <b><font color="#00008B" size="4">Gender</font></b>
  102. </td>
  103. <td>
  104. <input type="radio" name="MALE" value="on"><font color="#00008B">MALE</font>
  105. </br>
  106. <input type="radio" name="MALE" value="on"><font color="#00008B">FEMALE</font>
  107. </td>
  108. </tr>
  109.  
  110.  
  111.  
  112.  
  113. #00008B">FEMALE</font>
  114. </td>
  115. </tr>
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. <tr>
  123. <td >
  124. <button name="submit1" type="submit" value="autofocus">SUBMIT</button>
  125. </td>
  126. <td>
  127. <button name="reset1" type="reset" value="autofocus">RESET</button>
  128. </td>
  129. </tr>
  130. </table>
  131. </form>
  132. </body>
  133. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement