【发布时间】:2017-03-24 18:30:34
【问题描述】:
我有一个图像数组以及内容页面何时加载。数组中的一张图片将附加到 <div> id 并显示出来。
var GameQuestion = ["A?", "B?", "C?"];
var GameAnswer = [
["lib/True.png", "lib/False.png"],
["lib/True.png", "lib/False.png"],
["lib/True.png", "lib/False.png"]
];
var answerList,
random_Question;
random_Question = Math.floor(Math.random() * GameQuestion.length);
$("#question").html(GameQuestion[random_Question]);
answerList = GameAnswer[random_Question];
$("#Answer_1").html(answerList[0]);
$("#Answer_2").html(answerList[1]);
<!-- Original Question -->
<div id="question" style="position:absolute; z-index:6; top:750px; left:160px; margin:auto; color:#FFFFFF; font-size:30px; width:800px; text-align: center;"></div>
<!-- Answer-Original-Choice List -->
<div id="Answer_1" class="answers" style="position:absolute; z-index:6; top:1006px; left:224px; margin:auto; color:#FFFFFF; font-size:25px; width:750px;"></div>
<div id="Answer_2" class="answers" style="position:absolute; z-index:6; top:1186px; left:224px; margin:auto; color:#FFFFFF; font-size:25px; width:750px;"></div>
当内容页面加载时,我只能看到问题,但是,应该附加和显示图像的部分。它只显示文件路径名。
因此,如果内容页面加载问题:A?,则 2 图像 id 应加载并显示真假图像。但是此时,我只看到 img id "Answer_1" 和 "Answer_2" 的文件路径名 "lib/True.png" 和 "lib/False.png"。
那么,有什么问题吗?因为我需要 img id 来显示图像而不是显示文件路径名。
请帮忙。谢谢你
【问题讨论】:
-
您的
<img>...具体在哪里? -
@Gothdo,对不起,它本来是一个,我太昏昏沉沉了
标签: javascript jquery html arrays image