Forum Moderators: open
I don't know Java yet, and I had planned on purchasing several books about various programming but I need help right away on this one.
I need a script to be written, but also explained for me so I can reference it in the future. This shouldn't be long at all.
The form will consist of one text field, that is all.
There will be 6 different values that can be entered in this field. Let just call them:
1
2
3
4
5
6
Eventually these will be passwords that people can enter. Depending on the password, they will be redirected to a specific page, that is all.
If they do not enter the right one, then they will be redirected to an error page.
This is for a price list based on a promotion code they enter.
Please help if you can, thank you.
Nathan
If you aren't too bothered about people cheating, it wouldn't b hard to do something in Javascript that jumbles the information, so it's at least visibly hidden. Interested?
<html>
<head>
<title>test pass</title>
<script>
function checkPass()
{
window.location.href = document.getElementById("pass").value
}
</script>
</head>
<body>
<input id="pass" type="password" value = ""><br>
<button onclick="checkPass()">go</button><br>
</body>
</html>
I've entered the code.
So you coded it so if I enter in the code "1234", it will go to 1234.htm?
I've entered the code in for the correct page, however I get a 404 no matter what I enter. Does it look for the file in the same directory the password page is in, or is it looking for a file in the root folder?
nathan
The code that Bernard posted doesn't automatically add the ".html", so if a user enters "1234" then JavaScript will try to load a file named "1234", not a file named "1234.html". To get the ".html" added then change your "window.location..." line to this:
window.location.href = document.getElementById("pass").value + ".html";