英文:
replenishing pools in the html table
问题
我有一些在HTML中要做的表格,
<thead>
...
</thead>
<tbody>
// tbody有30行,每行15列。
</tbody>
在几列中,我需要插入字段
<input type = "time" name = "1st-row/1st-column">
<input type = "time" name = "2nd-row/1st-column">
<input type = "time" name = "3rd-row/1st-column">
<input type = "time" name = "30th-row/1st-column">
- 同样的2nd-column / 3rd-column / 5th-column + ... + 10th列
我是否需要直接通过HTML插入字段,是否有更快更清晰的方法?如果可以的话,如何做到这一点?
英文:
I have tables to do in html,
<thead>
...
</thead>
<tbody>
// tbody has 30 rows for 15 columns.
</tbody>
in several columns I have to insert the field
<input type = "time" name = "1st-row/1st-column">
<input type = "time" name = "2nd-row/1st-column">
<input type = "time" name = "3rd-row/1st-column">
<input type = "time" name = "30th-row/1st-column">
- the same 2nd-column / 3rd-column / 5th-column + ... + 10th column
Do I have to insert fields there directly via html, is it possible to do it faster and more clearly? If this is how to do it?
答案1
得分: 1
<table>
<thead>
</thead>
<tbody>
@for(int i=0;i<30;i++)
{
<tr>
@for(int y=0;y<15;y++)
{
<td>列... </td>
}
</tr>
}
</tbody>
</table>
英文:
<table>
<thead>
</thead>
<tbody>
@for(int i=0;i<30;i++)
{
<tr>
@for(int y=0;y<15;y++)
{
<td>columns...</td>
}
</tr>
}
</tbody>
</table>
答案2
得分: 0
创建一个循环,使用 document.createElement() 创建元素,然后使用 element.appendChild() 将它们添加进去。
英文:
Make a loop that creates elements with document.createElement() and add them with element.appendChild()
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论