I am in the middle of making a one use login using javascript to create if else statements to see if the input from my html form matches the correct username and login. i haven't been able to find out what the problem is but something is keeping it from loading the link i have it set to open when you use the correct login or even the wrong password text.
KEYNOTE : most of my code is from w3schools
</div> <!-- /container -->
<div align="center" class = "container">
<form class = "form-signin" role = "form" id ="LoginF"
action ="" method="post"
<h4> </h4>
<input type = "text" class = "form-control"
name = "username" id ="username" placeholder = "username = Johnny Appleseed"
required autofocus color="#00DD19"><br>
<input type = "password" class = "form-control"
name = "password" id="password" placeholder = "password = Yum @pple$" required>
<br><button class = "btn btn-lg btn-primary btn-block" type = "submit"
name = "login" id = "login" onclick="myFunction()">Login</button>
<script>
function myFunction() {
String username =
document.getElementById("username");
String password =
document.getElementById("password");
String Cusername = "TeacherLogin";
String Cpassword = "Hapke";
String Wrong = "Wrong user name or password";
if (username = Cusername){
if (password = Cpassword){
window.open("https://mail.google.com/mail/");
}else {System.out.print(Wrong);}
}else{System.out.print(Wrong);}
}
</script>
Aucun commentaire:
Enregistrer un commentaire