如何添加动态元素?

时间:2014-08-26 07:59:22

标签: javascript html

我目前正在努力解决一个(我想)的基本问题,但我无法找到答案。

我有一个可以在多个页面上打印的html表。

该表有一个标题和2个(或更多)副标题。

我已将标题放在标签内,标题可以使用:它会打印在每一页上。

但我无法动态更改字幕:第一个值没有字幕,然后我需要打印字幕。这就是我的表格应该是这样的:

<table>
    <thead style='display: table-header-group;'>
       <!--Here is my title with no subtitle-->
    </thead>
    <tr><td></td></tr>
    ...
    <tr><td></td></tr>
    <!--Here should be my subtitle that I need to repeat on every page after this point
        Title and subtitle n°1 should be on every page after this point.
    -->
    <tr><td></td></tr>        
    ...
    <tr><td></td></tr>
    <!--Here should be my second subtitle. First subtitle should not be printed anymore
        Title and subtitle n°2 should be on every page after this point
    -->
    <tr><td></td></tr>
    ...
    <tr><td></td></tr>
</table>

我该怎么做?

谢谢,

萨姆

编辑:我通过使用多个表来解决它。不过,我不能按照自己喜欢的方式格式化列,这是一个小问题,但现在看来是这样的:

<table>
    <thead style='display: table-header-group;'>
       <!--Here is my title with no subtitle-->
    </thead>
    <tr><td></td></tr>
    ...
    <tr><td></td></tr>
</table>
<table>
    <thead style='display: table-header-group;'>
    <!--Here should be my subtitle that I need to repeat on every page after this point
        Title and subtitle n°1 should be on every page after this point.
    -->
    </thead>
    <tr><td></td></tr>        
    ...
    <tr><td></td></tr>
</table>
<table>
    <thead style='display: table-header-group;'>
    <!--Here should be my second subtitle. First subtitle should not be printed anymore
        Title and subtitle n°2 should be on every page after this point
    -->
    </thead>
    <tr><td></td></tr>
    ...
    <tr><td></td></tr>
</table>

刚才我需要格式化每个宽度相同的td,取最大宽度......

0 个答案:

没有答案