Help needed with javascript redirecting

Hello, I need help with my simple login page, after you login correctly it’s supposed to take you to a website (google for example). But It’s not working.

HTML Code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Login</title>
    <link rel="stylesheet" href="/assets/css/admin.css">
    <script src="/assets/js/admin-login.js"></script>
</head>
<body>
    <form class="box" action="admin.html" method="GET">
        
<h1>
    Administrator Access
</h1>
<input type="text" name="" placeholder="Username" id="username">
<input type="password" name="" placeholder="Password" id="password">
<input type="submit" name="" value="LOGIN" onclick="validate()">

    </form>
</body>
</html>

JavaScript Code:

function validate()
{
    var username=document.getElementById("username").value;
    var password=document.getElementById("password").value;
    if(username=="user" & password=="pass") {

        window.location = "https://www.google.com"
        return false;
    }
    else
    {
        alert("sad fail ;c")
    }
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.