0

我正在尝试打印网页的一部分,但我无法使用 css 样式表对其进行格式化。这是我的代码。

Javascript:

function print()
{
  var Print=$("#myTable").html();
  newWin= window.open();
  newWin.focus();
  newWin.document.write("<html><head><title>Print Report</title><link rel='stylesheet' media='print' href='/timer/css/print.css' type='text/css'></head>");
  newWin.document.write("<body><h2>ENTERPRISE FILE SYSTEMS REPORT</h2>");
  newWin.document.write(Print);
  newWin.document.write("</body></html>");
  newWin.print();
  newWin.close();
}

其中 myTable 是我要打印的表格。css 文件“print.css”不会格式化页面。谁能告诉我如何解决这个问题?谢谢!

4

0 回答 0