如何获取隐藏文件夹中图像的文件路径? [英] How do I get file path for image in a hidden folder?
本文介绍了如何获取隐藏文件夹中图像的文件路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试制作一个复活节彩蛋,当用户单击带有特定文本输入的按钮时,该图片就会显示在其中.我将图像放在隐藏的文件夹中,但未显示.这是代码:
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>"
}
}
推荐答案
隐藏的文件夹通常以开头.因此隐藏的文件夹可能是images/.hidden/image.jpg.尝试更改<img src=''>
行
您很可能没有为图像设置有效路径`
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`
这篇关于如何获取隐藏文件夹中图像的文件路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文