I want to create a simple page where the user can type in different passwords that leads to different pages. One password is "dogs" and leads to a dog page. One password is "cats" and leads to a cats page etc. Basically multiple password from one password field.
Here's what I got so far:
<!DOCTYPE html>
<html>
<head>
<title>Login page</title>
</head>
<body>
<form>
<label for="pswd">Enter your password: </label>
<input type="password" id="pswd">
<input type="button" value="Submit" onclick="checkPswd();" />
</form>
<!--Function to check password the already set password is dogs-->
<script type="text/javascript">
function checkPswd() {
var confirmPassword = "dogs";
var password = document.getElementById("pswd").value;
if (password == confirmPassword) {
window.location="dogs.html";
}
else{
alert("Passwords do not match.");
}
}
</script>
</body>
</html>
This code is for dogs.html:
<!DOCTYPE html>
<html>
<head>
<title>Dogs page</title>
</head>
<body>
<h1>Welcome!! you entered the DOGS password</h1>
</body>
</html>