Wednesday, 4 February 2015

Create an HTML page for Registration Form using CSS

  1. <html>
  2. <head> 
  3. <script type="text/javascript">
  4.        function validate()
  5.        {
  6.           var a=document.f1.nm.value;
  7.           var b=document.f1.pw.value;
  8.           var c=document.f1.pwd.value;
  9.           var d=document.f1.mail.value;
  10.           if(a=="")
  11.           {
  12.             alert("Please enter name");
  13.           }
  14.          else if(b=="")
  15.           {
  16.             alert("Please enter password");
  17.           }
  18.         

  19.          else if(c=="")
  20.           {
  21.             alert("Please enter confirm password");
  22.           }
  23.           else if(d=="")
  24.           {
  25.             alert("Please enter name email");
  26.           }
  27.  
  28.        
  29.           
  30.           else if(d=="@abc")
  31.           { 
  32.             alert("Thanks for register us");
  33.           } 
  34.           else
  35.           { 
  36.             alert("please include a @ in password");
  37.           }
  38.           
  39.       }
  40. </script>  
  41. <title> Registration Form </title> 
  42. </head>
  43. <body bgcolor="skyblue">
  44. <form name="f1" method="post" onsubmit="validate()">
  45. <center>
  46. <table border="4">
  47. <h2> Registration Form</h2>
  48. <tr>
  49. <td>Username*</td><td><input type="text" name="nm" ></td>
  50. </tr>
  51. <tr>
  52. <td>Password*</td><td><input type="password" name="pw"></td>
  53. </tr>
  54. <tr>
  55. <td>Confirm password*</td><td><input type="password" name="pwd"></td>
  56. </tr>
  57. <tr>
  58. <td>Email*</td><td><input type="text" name="mail"></td>
  59. </tr>
  60. <tr>
  61. <td>Contact</td><td><input type="text" name="cnt"></td>
  62. </tr>
  63. <tr>
  64. <td>Age</td><td><input type="text" name="ag"></td>
  65. </tr>
  66. <tr>
  67. <td>Gender</td><td><input type="radio" name="gn">Male<input type="radio" name="gn">Female</td>
  68. </tr>
  69. <tr>
  70. <td>Qualification</td>
  71. <td>
  72. <select>
  73. <option >Select</option>
  74. <option>MCA</option>
  75. <option>MBA</option>
  76. <option>BTech</option>
  77. <option>BCA</option>
  78. <option>BBA</option>
  79. <option>BA</option>
  80. <option>Bsc.</option>
  81. </select>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td>Hobbies</td><td><input type="checkbox">Watch movie<input type="checkbox">Play cricket</td>
  86. </tr>
  87. <td>
  88. <input type="Submit" name="submit" value="submit">
  89. <input type="button" value="Cancel">
  90. </td>
  91. </table>
  92. </center>
  93. </form>
  94. </body>
  95. </html>

No comments:

Post a Comment