在HTML表格中重新填充池。

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

replenishing pools in the html table

问题

我有一些在HTML中要做的表格,

  1. <thead>
  2. ...
  3. </thead>
  4. <tbody>
  5. // tbody有30行,每行15列。
  6. </tbody>

在几列中,我需要插入字段

  1. <input type = "time" name = "1st-row/1st-column">
  2. <input type = "time" name = "2nd-row/1st-column">
  3. <input type = "time" name = "3rd-row/1st-column">
  4. <input type = "time" name = "30th-row/1st-column">
  • 同样的2nd-column / 3rd-column / 5th-column + ... + 10th列

我是否需要直接通过HTML插入字段,是否有更快更清晰的方法?如果可以的话,如何做到这一点?

英文:

I have tables to do in html,

  1. <thead>
  2. ...
  3. </thead>
  4. <tbody>
  5. // tbody has 30 rows for 15 columns.
  6. </tbody>

in several columns I have to insert the field

  1. <input type = "time" name = "1st-row/1st-column">
  2. <input type = "time" name = "2nd-row/1st-column">
  3. <input type = "time" name = "3rd-row/1st-column">
  4. <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

  1. <table>
  2. <thead>
  3. </thead>
  4. <tbody>
  5. @for(int i=0;i<30;i++)
  6. {
  7. <tr>
  8. @for(int y=0;y<15;y++)
  9. {
  10. <td>列... </td>
  11. }
  12. </tr>
  13. }
  14. </tbody>
  15. </table>
英文:
  1. &lt;table&gt;
  2. &lt;thead&gt;
  3. &lt;/thead&gt;
  4. &lt;tbody&gt;
  5. @for(int i=0;i&lt;30;i++)
  6. {
  7. &lt;tr&gt;
  8. @for(int y=0;y&lt;15;y++)
  9. {
  10. &lt;td&gt;columns...&lt;/td&gt;
  11. }
  12. &lt;/tr&gt;
  13. }
  14. &lt;/tbody&gt;
  15. &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:

确定