在HTML表格中重新填充池。

huangapple go评论100阅读模式
英文:

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>
英文:
 &lt;table&gt;
        &lt;thead&gt;

        &lt;/thead&gt;
        &lt;tbody&gt;
            @for(int i=0;i&lt;30;i++) 
                {
                  &lt;tr&gt;
                    @for(int y=0;y&lt;15;y++)
                    {
                     &lt;td&gt;columns...&lt;/td&gt;
                    }
                 &lt;/tr&gt;
               }
        &lt;/tbody&gt;
    &lt;/table&gt;

答案2

得分: 0

创建一个循环,使用 document.createElement() 创建元素,然后使用 element.appendChild() 将它们添加进去。

英文:

Make a loop that creates elements with document.createElement() and add them with element.appendChild()

huangapple
  • 本文由 发表于 2020年1月3日 21:27:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/59579426.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定