Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我的数组没有将图片加载到html_Javascript_Jquery_Html - Fatal编程技术网

Javascript 我的数组没有将图片加载到html

Javascript 我的数组没有将图片加载到html,javascript,jquery,html,Javascript,Jquery,Html,我相信我的编码是正确的,但我没有让图像显示出来 以下是一系列问题、答案和图片: var questions = [ question:"Where should choking victims place their hands to indicate to others that they need help?", choices:["A: Over the eyes", "B: Around the throat", "C: On the knees", "D: On the hips"

我相信我的编码是正确的,但我没有让图像显示出来

以下是一系列问题、答案和图片:

var questions = [

question:"Where should choking victims place their hands to indicate to others that they need help?",

choices:["A: Over the eyes", "B: Around the throat", "C: On the knees", "D: On the hips"],
correctAnswer:"B: Around the throat",

image:"<img: src='../assets/images/jeopardy.png' class='cashMoney'>"]
function playerWin() {
    var image = questions[questionTracker].image;
    $("#gameShow").html(image);
    $("#gameShow").html("<p>You got it right!</p>");
}
var问题=[
问题:“窒息的受害者应该把手放在哪里向其他人表示他们需要帮助?”,
选择:[“A:在眼睛上方”、“B:在喉咙周围”、“C:在膝盖上”、“D:在臀部”],
正确答案:“B:在喉咙周围”,
图像:“]
这里是如何 我称之为图像:

var questions = [

question:"Where should choking victims place their hands to indicate to others that they need help?",

choices:["A: Over the eyes", "B: Around the throat", "C: On the knees", "D: On the hips"],
correctAnswer:"B: Around the throat",

image:"<img: src='../assets/images/jeopardy.png' class='cashMoney'>"]
function playerWin() {
    var image = questions[questionTracker].image;
    $("#gameShow").html(image);
    $("#gameShow").html("<p>You got it right!</p>");
}
函数playerWin(){
var image=questions[questionTracker].image;
$(#gameShow”).html(图片);
$(“#gameShow”).html(“你说对了!

”; }
我还尝试通过自己的函数将图像附加到Div

function displayImage() {
    var image = questions[questionTracker].image;
    $("#gameShow").append("<images>");
}
函数displayImage(){
var image=questions[questionTracker].image;
$(“#gameShow”)。追加(“”);
}
图像应显示标记,但它不显示

这一切都很新鲜。非常感谢您的帮助!
对不起,如果我没有正确设置问题的格式。它在编辑器上看起来不错,但在我发布时会丢失缩进:/

由于无效的HTML,您的图像无法工作:

<img src: '...'>

不应该有冒号。替换阵列中的此行:

image:"<img: src='../assets/images/jeopardy.png' class='cashMoney'>"]
图像:“”
这一行:

image:"<img src='../assets/images/jeopardy.png' class='cashMoney'>"];
图像:“”;

你的问题会得到解决。

为什么你有两个B选项?应该是
而不是
。你应该做
$(“#gameShow”).append(图像)请不要只指出印刷问题或缺少字符就发布答案。这些答案不太可能对未来的访客有所帮助,因为它们是OP的代码所特有的。相反,根据标题,用旗帜或投票来结束这个问题。当然,我的错。天哪,我觉得自己太愚蠢了。谢谢,没问题。如果我的回答对你有帮助,你能接受/更新它以备将来参考吗?很抱歉,在这里发布新消息。我应该把这根柱子移走吗?