嗨,我想在里面显示一个项目列表
示例 html 代码
<h3 id="game-filter" class="gamesection">
<span>Game</span></h3>
<div id="game-filter-div" style="padding: 0;">
<ul id="gamelist">
</ul>
</div>
代码
var games = new Array();
games[0] = "World of Warcraft";
games[1] = "Lord of the Rings Online";
games[2] = "Aion";
games[3] = "Eve Online";
games[4] = "Final Fantasy XI";
games[5] = "City of Heros";
games[6] = "Champions Online";
games[7] = "Dark Age of Camelot";
games[8] = "Warhammer Online";
games[9] = "Age of Conan";
function pageLoaded(){
var list = "";
for(i=0; i<games.length; i++){
list ="<li>"+games[i]+"</li>";
$("#gamelist").append(list);
//document.getElementById("gamelist").innerHTML=list;
list = "";
}
}
似乎我的js代码有问题。它不输出任何东西