Advertisement
Guest User

Untitled

a guest
Jan 15th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. function validateForm() {
  2. var frm = document.login;
  3. if(frm.username.value=="abc" && frm.password.value=="abc123"){
  4. alert ();
  5. }else {
  6. alert ();
  7. }
  8. }
  9.  
  10. <form id="login" name="login" action="" method="post" onsubmit="return validateForm()" >
  11. <h3>My Login Form</h3>
  12. <p>Username : <input type="text" name="username" id="username" /></p>
  13. <p>Password : <input type="password" name="password" id="password" /></p>
  14. <p><input type="submit" name="submit" id="submit" value="Login" /></p>
  15. </form>
  16.  
  17. function validateForm() {
  18. var frm = document.login;
  19. if(frm.username.value=="abc" && frm.password.value=="abc123"){
  20. alert ();
  21. }else {
  22. alert ();
  23. }
  24. }
  25.  
  26. <form id="login" name="login" action="" method="post" onsubmit="return validateForm()" >
  27. <h3>My Login Form</h3>
  28. <p>Username : <input type="text" name="username" id="username" /></p>
  29. <p>Password : <input type="password" name="password" id="password" /></p>
  30. <p><input type="submit" name="submit" id="submit" value="Login" /></p>
  31. </form>
  32.  
  33. <!DOCTYPE html>
  34. <html lang="en">
  35. <head>
  36. <meta charset="utf-8">
  37. <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame Remove this if you use the .htaccess -->
  38. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  39. <title>test2</title>
  40. <meta name="description" content="">
  41. <meta name="author" content="ITS The 1 - Yesh">
  42. <meta name="viewport" content="width=device-width; initial-scale=1.0">
  43. <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
  44. <link rel="shortcut icon" href="/favicon.ico">
  45. <link rel="apple-touch-icon" href="/apple-touch-icon.png">
  46. <script>
  47. function validateForm() {
  48. var frm = document.login;
  49. if(frm.username.value=="abc" && frm.password.value=="abc123"){
  50. alert ("You Are Doing Well");
  51. }else {
  52. alert ("Please Fill Your Username And Password!");
  53. username.focus();
  54. return false;
  55. }
  56. }
  57. </script>
  58. </head>
  59. <body>
  60. <div>
  61. <form id="login" name="login" action="" method="post" onsubmit="return validateForm()" >
  62. <h3>My Login Form</h3>
  63. <p>Username : <input type="text" name="username" id="username" /></p>
  64. <p>Password : <input type="password" name="password" id="password" /></p>
  65. <p><input type="submit" name="submit" id="submit" value="Login" /></p>
  66. </form>
  67. </div>
  68. </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement