I have a JavaScript function that fills a table:(我有一个填充表格的JavaScript函数:)
<script>
var col1 = ["Full time student checking (Age 22 and under) ", "Customers over age 65", "Below $500.00"];
var col2 = ["None", "None", "$8.00"];
function createtable() {
<!--To fill the table with javascript-->
for (var j = 0; j < col1.length; j++) {
if (j % 2 == 0) {
document.write("<tr><td>" + col1[j] + " </td>");
document.write("<td>" + col2[j] + "</td></tr>");
} else {
document.write("<tr bgcolor='#aeb2bf'><td>" + col1[j] + " </td>");
document.write("<td>" + col2[j] + "</td></tr1>");
}
}
}
</script>
I want to execute it within the HTML body.(我想在HTML正文中执行它。) I have tried the following, but it doesn't create the table.(我尝试了以下,但它没有创建表。)
<table>
<tr>
<th>Balance</th>
<th>Fee</th>
</tr>
createtable();
</table>
How I can execute this function within the HTML body?(我如何在HTML体内执行此功能?)
ask by user2804038 translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…