我会说这样做(我会假设你不会加载jquery或任何花哨的东西):
var outputTable = "
//the div to write the output to
var outputDiv = document.getElementById("output");
//the loop that writes the table
for (var i=0; i
outputTable += "
"+i+""+myList[i]+"";}
//close the table
outputTable += "
";//write the table
outputDiv.innerHTML = outputTable;
}
希望这可以帮助 :)