I made a login with javascript where if you enter the correct username and password you can enter the home page. You can find the username and password in the script. I finish the javascript code and I tested the login. When I entered, it did not redirect to the home page html file but instead just reloaded. The main problem is that, when I submit/login the username and password, it is not going home page html file. Here is the code:
function Login() {
var username = document.getElementById("user").value;
var password = document.getElementById("pass").value;
if (username == "will" && password == "will") {
window.location.href = "home.html";
} else {
alert("Sadly, your not in the club");
}
}
@import url("https://fonts.googleapis.com/css2?family=Amatic+SC&display=swap");
* {
font-family: "Amatic SC", cursive;
text-align: center;
}
form {
text-align: center;
justify-content: center;
height: 400px;
}
h1 {
padding: 30px;
}
input,
button {
padding: 10px;
width: 110px;
font-size: 30px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>.WWW Login</title>
</head>
<body>
<form>
<h1>.WWW Login</h1>
<input placeholder="Username" type="text" id="user" required />
<br />
<br />
<input placeholder="Password" type="password" id="pass" required />
<br />
<br />
<button onclick="Login();">Login</button>
</form>
</body>
</html>