日期:2014-05-16 浏览次数:20344 次
<table id="demo"> <tr> <td>111</td> <td>AAA</td> </tr> </table> <script type="text/javascript"> var ar = [['222', 'BBB'], ['333', 'CCC']]; var oTable = document.getElementById('demo'); for (var i = 0; i < ar.length; i ++) { var tr = oTable.insertRow(-1); for (var j = 0; j < ar[i].length; j ++) { var td = tr.insertCell(j); td.innerHTML = ar[i][j]; } } </script>