Problem with Login Code
As a newcomer to HTML, CSS, and almost unknown in Javascript, I sought help from others to create a login code. The code was working fine earlier, but now it's not functioning as expected. Despite checking everything, I can't seem to pinpoint the issue.
The intended functionality is that on the website labavakara.neocities.org, entering 'admin' and 'labadiena' in the login form should redirect you to another website of mine.
I'm struggling to identify my mistake. The function check(form) is supposed to verify the input user details against the correct username and password.
Upon inspecting the site and checking the console for errors, I found none.
Code Snippet
<!DOCTYPE html>
<html>
<head>
<style>
div {
height: 200px;
width: 400px;
position: fixed;
top: 50%;
left: 55%;
margin-top: -100px;
margin-left: -200px;
}
body {
background-image: url("backg.png");
background-color: #cccccc;
}
function {
color: red;
}
</style>
<body>
<script>
function check(form)
{
if(form.loginInput.value == "admin" && form.passwordInput.value == "labadiena")
{
window.location.href = "https://labavakara.neocities.org/trysketuri.html";
}
else
{
alert("Error Password or Username")
}
}
</script>
<div>
<title>Login</title>
<form>
<p><input style="background-color:red;color:black;border:1px solid #ff0000" type="text" id="loginInput" name="login" value="" placeholder="Username"></p>
<p><input style="background-color:red;color:black;border:1px solid #ff0000" type="password" id="passwordInput" name="password" value="" placeholder="********"></p>
<a class="submit"><input style="color:blue" type="submit" id="loginbutton" onclick="check(this.form)" name="commit" value="Login"><br>
<label id="userMessage" style="visibility:hidden;"></label>
</a>
</form>
</div>
</body>
</html>