Advertisement
ivandrofly

Javascript - Form validation

May 6th, 2014
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title></title>
  5. </head>
  6. <body>
  7. <form name="ivandroForm">
  8.     Username:  <input type="text" name="username" />
  9.     Password:  <input type="password" name="password" />
  10.     <input type="checkbox" name="checkBoxIsMale">
  11.     <input type="submit" value="Verify" onclick="validator()" />
  12. </form>
  13.  
  14. <script type="text/javascript">
  15.     function validator(){
  16.         if(ivandroForm.checkBoxIsMale.checked)
  17.         {
  18.             alert("You are male!");
  19.         }
  20.         else
  21.         {
  22.             alert("You are female!");
  23.         }
  24.     }
  25. </script>
  26. </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement