//Verification of Valid Password
- <html>
- <head>
- <title> Verification of Valid Password </title>
- </head>
- <script>
- function verifyPassword() {
- var pw = document.getElementById("pswd").value;
- var cpw = document.getElementById("cpswd").value;
- //check empty password field
- if(pw == "") {
- document.getElementById("message").innerHTML = "**Field Should Not Be Empty!";
- return false;
- }
- if(cpw == "") {
- document.getElementById("message").innerHTML = "**Field Should Not Be Empty!";
- return false;
- }
- if (pw == cpw)
- {
- alert("Password is Correct..!!");
- }
- else {
- alert("Password is Wrong..!!");
- }
- //minimum password length validation
- if(pw.length < 8) {
- document.getElementById("message").innerHTML = "**Password length must be atleast 8 characters";
- return false;
- }
- }
- </script>
- <body>
- <center>
- <h1 style="color:green">Verify Valid Password</h1>
- <form onsubmit ="return verifyPassword()">
- <!-- Enter Password -->
- <td> Enter Password </td>
- <input type = "password" id = "pswd" value = ""><br><br>
- <span id = "message" style="color:red"> </span> <br>
- <td> Enter Confirmed Password </td>
- <input type = "password" id = "cpswd" value = "">
- <span id = "message" style="color:red"> </span> <br><br>
- <!-- Click to verify valid password -->
- <input type = "submit" value = "Submit">
- <!-- Click to reset fields -->
- <button type = "reset" value = "Reset" >Reset</button>
- </form>
- </center>
- </body>
- </html>
👉Execute👈