我正在尝试创建一个“Jeopardy”(en.wikipedia.org/wiki/Jeopardy!)风格的游戏。我设置的方式是 5 x 5 矩阵或多维数组。我正在尝试编写一个代码来遍历每个数组,然后将值放入另一个 HTML DIV。
这是我的代码:
查询:
var clues = new Array ();
[0] [0] = "On the world political map, where were some of the major states and empires located about 1500 A.D. (C.E.)?";
[0] [1] = "What were the artistic, literary, and intellectual ideas of the Renaissance?";
[0] [2] = "Where were the five world religions located around 1500 A.D. (C.E.)?";
[0] [3] = "What were the regional trading patterns about 1500 A.D. (C.E.)?";
[0] [4] = "Why were the regional trading patterns important?";
$.each(clues, function(){
$("#rowOne").append('<li>' +value+ '</li>');
('li').on('click','a', function(){
var foo = $(this).text();
$('#clueContainer').text(clues [foo]);
});
});
HTML:
<ul id="rowOne" class="center">
<li><a href="#">$100</a></li>
<li><a href="#">$100</a></li>
<li><a href="#">$100</a></li>
<li><a href="#">$100</a></li>
<li><a href="#">$100</a></li>
</ul>
新分区:
<div id="clueContainer" class="center"></div>
但是,当我运行代码时,新的 HTML DIV 中没有显示任何内容。
有人可以帮忙吗?