fuxun

 

备忘,记录一下。

在需要打印页面生成一个div,ID为“Printing”;状态为display:none;使打印内容隐藏在该页面上,div里面的内容就是打印的内容根据需求填充即可。

然后给打印按钮加点击事件点击时调用该方法,一个简单打印功能就实现了。

 

function PrintArticle() { var pc = document.getElementById("Printing"); var pw = window.open('', '', 'width=1200,height=800'); pw.document.write('

'); pw.document.write(''); pw.document.write(''); pw.document.write(''); pw.document.write(''); pw.document.write(pc.innerHTML); pw.document.write(''); pw.document.write(''); pw.document.close(); pw.print(); return false; } $(".Printing").click(function () { PrintArticle() })

分类:

技术点:

相关文章:

  • 2021-11-28
  • 2021-11-28
  • 2021-10-06
  • 2019-09-30
  • 2021-12-28
  • 2021-11-18
  • 2021-11-18
猜你喜欢
  • 2021-11-18
  • 2021-11-17
  • 2021-12-29
  • 2021-08-30
  • 2021-05-09
  • 2021-11-18
相关资源
相似解决方案