I am trying to make an easter egg where an image displays when a user clicks a button with certain text input. I put the image in a hidden folder, but it is not displaying. This is the code:
HTML
<input type="textbox" id="text1">
<input type="button" value="Generate Entry" onclick="submitButtonClicked();secretFunction()">
JS
function secretFunction(){
let secretCode = document.getElementById("text1").value;
if (secretCode == "Secret" || secretCode == "secret"){
var win2 = window.open("", "Title", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=650,top="+(screen.height-400)+",left="+(screen.width-840));
win2.document.body.innerHTML = "<img src='/img/secretImage.png'>" + "<br><h1>Congratulations!</h1>"
}
}
hidden folders normally are preceded by a. so a hidden folder might be images/.hidden/image.jpg. try changing the <img src=''>
line most likely you have not put a valid path to the image`
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.