Greener
Greener
KPCKevin Powell - Community
Created by Greener on 1/21/2024 in #front-end
Login Page
I want this developer.html to go to index.html when I press login if the username and password are correct. here is the code
<!DOCTYPE html>
<html>
<head>
<title>Developer Login</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="form-box">
<h1>Login Here</h1>
<div class="input-box">
<input type="email" placeholder="Email or Username" id="emailInput">
</div>
<div class="input-box">
<input type="password" placeholder="password" id="passwordInput">
</div>
<button class="login-btn" onclick="loginButton(this)" value="index.html">LOGIN</button>
</div>
<script>
function loginButton(link){
let email = "PD";
let password = "PDP";

if(document.getElementById("passwordInput") === password){
if(document.getElementById("emailInput") === email){
console.log(link.value);
location.href = link.value
};
};
};
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Developer Login</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="form-box">
<h1>Login Here</h1>
<div class="input-box">
<input type="email" placeholder="Email or Username" id="emailInput">
</div>
<div class="input-box">
<input type="password" placeholder="password" id="passwordInput">
</div>
<button class="login-btn" onclick="loginButton(this)" value="index.html">LOGIN</button>
</div>
<script>
function loginButton(link){
let email = "PD";
let password = "PDP";

if(document.getElementById("passwordInput") === password){
if(document.getElementById("emailInput") === email){
console.log(link.value);
location.href = link.value
};
};
};
</script>
</body>
</html>
10 replies