This code is not working

Joined
Dec 9, 2020
Messages
3
Reaction score
0
Cam you please help me fix this code

<!DOCTYPE html>
<html>
<head>
<title>Password</title>
<style>
body {
background-color: lightblue;
padding: 30px;
}
</style>
<script>
function checkPassword() {
var password = document.getElementById("passwordBox");
var passwordText = password.value;
if(passwordText == "obeseduck123") {
return true;
}
alert("Access Denied Incorrect Password");
return false;
}
</script>
</head>
<body>
<p style="font-size: 30pt;">Ciaran's To-Do List</p>
<p>Please enter the password to continue.</p>
<p>Password:<input id="passwordBox" type="password"/></p>
<a href="hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html" onclick="return
checkPassword();">
Click here to submit password
</a>
</body>
</html>
 
Joined
Nov 13, 2020
Messages
302
Reaction score
38
The big question here is WHAT IS NOT WORKING? and FYI, this code, although horrible, works.
 
Joined
Dec 9, 2020
Messages
3
Reaction score
0
The big question here is WHAT IS NOT WORKING? and FYI, this code, although horrible, works.
The problem is that the code lets me pass to the html file called "hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html" with anything in the text box.
 
Joined
Nov 13, 2020
Messages
302
Reaction score
38
You did not write this to pass anything.
"anything in the text box." is the password. This password is sent to the JS section (so to speak) and the function named checkPassword sees if that word is "obeseduck123" and if it is your code will call the HTML page you want.

Do you want to send something to the called page?
 
Joined
Dec 10, 2020
Messages
10
Reaction score
1
The problem is in the Script file because the frontend is working correctly but after the click, it performs well.
In this code hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html is not working so please check.
 
Joined
Nov 13, 2020
Messages
302
Reaction score
38
Devid, please explain how you can read the mind of TechSide MC. And how can we troible shoot hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html if we're not giving that code.
 
Joined
Dec 10, 2020
Messages
10
Reaction score
1
Hello BigDady,
Make a file of HTML type save in the same folder name as hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html then check it.
 
Joined
Dec 9, 2020
Messages
3
Reaction score
0
When I enter the password "obeseduck123" it is supposed to redirect me to hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html. It redirects me to hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html even if I have the wrong password. I want it to redirect me to hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html only when the password is "obeseduck123".
 
Joined
Nov 13, 2020
Messages
302
Reaction score
38
combine line 27 and 28 to read
<a href="hahhiatuhsrouhgaoluhlohtourhzhzourhluthur.html" onclick="return checkPassword();">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,931
Messages
2,570,085
Members
46,536
Latest member
keelop

Latest Threads

Top