Advertisement
Guest User

meow

a guest
Sep 11th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>JavaScript form validation Example</title>
  4. <script language="javascript">
  5. function validateForm(){
  6. var name = document.frm_email.txt_name.value
  7. var password = document.frm_email.txt_pwd.value
  8. if (name=="" || name==null)
  9. alert("Username cannot be blank")
  10. else if (password=="" || password==null)
  11. alert("Password cannot be blank")
  12. else
  13. alert('Validation successful...')
  14. }
  15. </script>
  16. </head>
  17. <body>
  18. <form name="frm_email">
  19. <h1>Login using your email & Password </h1><br>
  20. Username: <input type="text" name="txt_name"><br>
  21. Password: <input type="password" name="txt_pwd"><br>
  22. <input type="button" name="validate" value="validate"
  23. onClick="validateForm()">
  24. </form>
  25. </body>
  26. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement