40 lines
1.0 KiB
HTML
40 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
|
|
<body>
|
|
<h2>Login:</h2>
|
|
<form>
|
|
<label for="username">Username:</label>
|
|
<input type="text" name="username" placeholder="Jadoo">
|
|
<label for="password">Password:</label>
|
|
<input type="password" name="password" placeholder="****">
|
|
<label style="font-style: italic; color: red;" id="msg"></label>
|
|
<input type="button" value="Login">
|
|
</form>
|
|
|
|
<script>
|
|
document.querySelector("input[type=button]").onclick = () => {
|
|
const username = document.querySelector("input[name=username]").value;
|
|
const password = document.querySelector("input[name=password]").value;
|
|
const msg = document.querySelector("#msg");
|
|
|
|
const lusername = localStorage.getItem("username");
|
|
const lpassword = localStorage.getItem("password");
|
|
|
|
if(username != lusername || password != lpassword) {
|
|
msg.innerHTML = "Login Failed!";
|
|
return;
|
|
}
|
|
|
|
window.open("login_success.html", "main");
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|