Javascript 使用printThis.js重复页眉和页脚

Javascript 使用printThis.js重复页眉和页脚,javascript,jquery,html,css,printthis,Javascript,Jquery,Html,Css,Printthis,我想使用printThis.js插件打印所有页面中页眉和页脚重复且不重叠的大型html内容 但页眉和页脚并没有重复 $(“#printKitten”)。单击(函数(){ $(“#divContent”)。打印此({ 页眉:$('#divHeader').html, 页脚:$('#divFooter').html }); }); 印刷品 标题标题标题标题标题标题标题 内容占位符开始 内容占位符 内容占位符 内容占位符 内容占位符 内容占位符 内容占位符 内容占位符 内容占位符 内容占位符 内

我想使用printThis.js插件打印所有页面中页眉和页脚重复且不重叠的大型html内容

但页眉和页脚并没有重复


$(“#printKitten”)。单击(函数(){
$(“#divContent”)。打印此({
页眉:$('#divHeader').html,
页脚:$('#divFooter').html
});
});

印刷品
标题
标题
标题
标题
标题
标题
标题
内容占位符开始

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符

内容占位符…结束

页脚
页脚
页脚
页脚
页脚
页脚
似乎没有此功能

你可以要求

同时,您可能需要考虑使用CSS。它使用一个

元素,其中其
thead
tfoot
重复,但其
tbody
不重复

引用基本设置:

<table class="report-container">
  <thead class="report-header"> </thead>
  <tfoot class="report-footer"> </tfoot>
  <tbody class="report-content"> </tbody>
</table>
CSS

thead.report-header {
   display: table-header-group;
}

tfoot.report-footer {
   display:table-footer-group;
}

tabel.report-container {
    page-break-after: always;
}

去看看那篇文章。这是一个很好的解释,并可能作为一个伟大的解决办法服务器

您好,我采用了这种方法,可以很好地使用Chrome和FF,但它总是以Report#2格式打印,我想要在Report#1中打印。我在代码中找不到更新的位置。非常感谢你的帮助。那将是另一个问题。请专门为此贴一个不同的。一定要提供一些代码,这样无论谁回答,都可以重现你的行为。建议你,贴出一个新问题。
thead.report-header {
   display: table-header-group;
}

tfoot.report-footer {
   display:table-footer-group;
}

tabel.report-container {
    page-break-after: always;
}