var i = prompt("Enter The Password:");
if (i === "hawaiian tropical" || "Hawaiian Tropical") {
onclick="location.href='';"
}
there is the code. as you see, i am trying to make sure the password is 1 of the 2 and if they are, go to a specific link. But right now it is not working. Any suggestions?
I am a bit confused. The title and the body of the question each ask for two different things. If you want to go to a specific URL if the password is correct, then this would work:
var i = prompt("Enter The Password:");
if (i === "hawaiian tropical" || i === "Hawaiian Tropical") {
window.location.href = '';
}
While if you want to go to a specific URL when the password is correct and a button is clicked, use this:
var i = prompt("Enter The Password:"); if (i === "hawaiian tropical" || i === "Hawaiian Tropical") { document.getElementById("myBtn").onclick = window.location.replace(''); }
<button id="myBtn">Click here</button>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.