Advertisement
Guest User

Untitled

a guest
Aug 14th, 2014
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.60 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.     <head>
  5.         <title>form-1</title>
  6.     </head>
  7.     <body>
  8.         <form action="register.php" id="registration" method="get">
  9.             Email: <input name="email" type="text"/>
  10.             <br/>
  11.             Password: <input name="password" type="password"/>
  12.             <br/>
  13.             Password again: <input name="confirmation" type="password"/>
  14.             <br/>
  15.             I agree to the terms and conditions: <input name="agreement" type="checkbox"/>
  16.             <br/><br/>
  17.             <input type="submit" value="Register"/>
  18.         </form>
  19.         <script>
  20.             var form = doucument.getElementById('registration');
  21.            
  22.             form.onsubmit = function() {
  23.                
  24.                 if (form.email.value == '')
  25.                 {
  26.                     alert('Give email id!');
  27.                     return false;
  28.                 }
  29.                
  30.                 else if (form.password.value = '')
  31.                 {
  32.                     alert('Give password!');
  33.                     return false;
  34.                 }
  35.                
  36.                 else if (form.password.value != form.confirmation.value)
  37.                 {
  38.                     alert('Passwords dont match!');
  39.                     return false;
  40.                 }
  41.                
  42.                 else if (!form.agreement.checked)
  43.                 {
  44.                     alert('agreement unchecked!');
  45.                     return false;
  46.                 }
  47.                
  48.                 return true;
  49.                
  50.             };
  51.         </script>
  52.     </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement