我用 HTML、CSS 和Bootstrap创建了一个简单的表格,我想更改单元格中的日期。(翻译文本)
<table class="table table-striped" id="TabelPret">
<thead>
<tr>
<th scope="col">id</th>
<th scope="col">service</th>
<th scope="col">price(Euro)</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>consulting</td>
<td>50</td>
</tr>
<tr>
<th scope="row">2</th>
<td>RECONSULT</td>
<td>15</td>
</tr>
<tr>
<th scope="row">3</th>
<td>1 procedur/30 min</td>
<td>10</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
现在对于 JS,我尝试选择表然后添加新行和列:
var array = [
["a1", "b1", "c1"],
["a2", "b1", "c1"],
["a3", "b1", "c1"],
["a4", "b1", "c1"],
["a5", "b1", "c1"],
["a6", "b1", "c1"],
["a7", "b1", "c1"]
];
Run Code Online (Sandbox Code Playgroud)
该数组将是新单元格,因此(a1翻译为 id,b1翻译为咨询,c1翻译为价格......等)
table = …Run Code Online (Sandbox Code Playgroud)