Herro,我正在尝试通过 Javascript 生成一个 html 表,但是我的输出失败了:
HTML:
<div id="racks" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" style="overflow: auto; display: block; height: 196.8px;" aria-labelledby="ui-accordion-accordion-header-2" role="tabpanel" aria-expanded="true" aria-hidden="false">
<table border="1">
<tbody>
<tr></tr>
</tbody>
</table>
<a onclick="alert(LSZ09 )" href="#">*</a>
<a onclick="alert(LSZ10 )" href="#">*</a>
</div>
Javascript:
document.getElementById("racks").innerHTML = "<table border='1'><tbody><tr>";
for (var i=0;i<16;i++)
{
document.getElementById("racks").innerHTML = document.getElementById("racks").innerHTML +"<td><a href='#' onClick='alert('"+jPunten[i].STATDEV+"')'>*</a></td>";
}
document.getElementById("racks").innerHTML = document.getElementById("racks").innerHTML + "</tr></table>";