【发布时间】:2020-04-03 23:40:16
【问题描述】:
我想打印两张网站。我只使用body:after 进行打印。问题是 :after 的内容出现在两个打印页面上。
body:after {
content: "This printout is intended for the customer. Please keep it in a safe place.";
position: absolute;
bottom: 0px;
}
为了更好地理解:我想打印两张内容几乎相同的纸,除了后面的引号。
我用 Jquery 的clone() 克隆了#content,但我没有克隆整个正文。
我该如何解决这个问题?或者有没有更好的方法来做这件事?
【问题讨论】:
-
您可以创建一个 DIV 并使用隐藏属性仅打印该 DIV 内的内容,假设您正在使用引导程序。此外,您应该从 CSS 文件中删除绝对位置
-
我没有使用 cms,但是这个技巧应该可以工作还是?我想要在工作表底部的报价。那我还应该做什么?
-
function PrintElem(elem) { var mywindow = window.open('', 'PRINT', 'height=400,width=600'); mywindow.document.write('
' + document.title + ' '); mywindow.document.write(''); mywindow.document.write('' + document.title + '
'); mywindow.document.write(document.getElementById(elem).innerHTML); mywindow.document.write(''); mywindow.document.close(); // 对于 IE >= 10 是必需的 mywindow.focus(); // 对于 IE >= 10 */ mywindow.print(); 是必需的mywindow.close();返回真; }
标签: javascript jquery css printing