Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function validateForm() {
- var frm = document.login;
- if(frm.username.value=="abc" && frm.password.value=="abc123"){
- alert ();
- }else {
- alert ();
- }
- }
- <form id="login" name="login" action="" method="post" onsubmit="return validateForm()" >
- <h3>My Login Form</h3>
- <p>Username : <input type="text" name="username" id="username" /></p>
- <p>Password : <input type="password" name="password" id="password" /></p>
- <p><input type="submit" name="submit" id="submit" value="Login" /></p>
- </form>
- function validateForm() {
- var frm = document.login;
- if(frm.username.value=="abc" && frm.password.value=="abc123"){
- alert ();
- }else {
- alert ();
- }
- }
- <form id="login" name="login" action="" method="post" onsubmit="return validateForm()" >
- <h3>My Login Form</h3>
- <p>Username : <input type="text" name="username" id="username" /></p>
- <p>Password : <input type="password" name="password" id="password" /></p>
- <p><input type="submit" name="submit" id="submit" value="Login" /></p>
- </form>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame Remove this if you use the .htaccess -->
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <title>test2</title>
- <meta name="description" content="">
- <meta name="author" content="ITS The 1 - Yesh">
- <meta name="viewport" content="width=device-width; initial-scale=1.0">
- <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
- <link rel="shortcut icon" href="/favicon.ico">
- <link rel="apple-touch-icon" href="/apple-touch-icon.png">
- <script>
- function validateForm() {
- var frm = document.login;
- if(frm.username.value=="abc" && frm.password.value=="abc123"){
- alert ("You Are Doing Well");
- }else {
- alert ("Please Fill Your Username And Password!");
- username.focus();
- return false;
- }
- }
- </script>
- </head>
- <body>
- <div>
- <form id="login" name="login" action="" method="post" onsubmit="return validateForm()" >
- <h3>My Login Form</h3>
- <p>Username : <input type="text" name="username" id="username" /></p>
- <p>Password : <input type="password" name="password" id="password" /></p>
- <p><input type="submit" name="submit" id="submit" value="Login" /></p>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement