【问题标题】:remove the url, date,page no while taking print打印时删除 url、日期、页码
【发布时间】:2010-12-05 15:58:06
【问题描述】:

我在 div 中有内容,div id print_my_content,

我想在 print_my_content DIV 中打印内容,

我不想打印 URL、日期、页码、

我现在的脚本打印这些和所有,

还有打印机设备是DOT MATRIX PRINTER,纸张是凭证(尺寸是550宽550高,

所以我的内容也应该设置在这些高度和宽度内,

给点建议,

var prtContent = document.getElementById(strid);
var WinPrint =
window.open('','','left=0,top=0');
WinPrint.document.write(prtContent.innerHTML);
alert(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne; 

【问题讨论】:

    标签: javascript


    【解决方案1】:

    您应该使用 CSS。

    您的普通 css 文件将使元素(div、span 等)可见,但您的“@media print”文件会将它们设置为“display:none”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-19
      • 2010-10-09
      • 2017-02-15
      • 2011-02-23
      • 1970-01-01
      • 2018-11-11
      • 2011-12-04
      相关资源
      最近更新 更多