Hi all,
I’m obviously not an expert. Can anyone please help me with html code to make a simple password field? I need it to redirect to one page if the password is correct and also redirect to a different page if the password is incorrect.
It doesn’t have to be a very secure login. It’s for a simple website form to submit an answer that is either right or wrong.
The following code is what I’ve been playing with and the redirect for the false password doesn’t work. Also, it’s a button with a popup prompt and I would actually prefer a text field to submit on keying enter.
If anyone can help me with either problem, I would so appreciate any help.
<html>
<HEAD>
<SCRIPT LANGUAGE=”JavaScript”>
function LogIn(){
password=”mypassword”;
password=prompt(“Enter password:”,””);
password=password.toLowerCase();
if (password==”mypassword”) {
loggedin=true;
window.location=”
}
if (password==false) {
loggedin=false;
window.location=”
}
}
</SCRIPT>
<BODY>
<center>
<form><input type=button value=”Enter Password” onClick=”LogIn()”></form>
</center>
</body>
</html>