码迷,mamicode.com
首页 > Web开发 > 详细

js实现页面的局部打印

时间:2015-08-19 20:07:25      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

以前用的 $("#print_div_contractnumber4").jqprint(); 现在不知为何不能用了

只能用下面的方法实现局部打印了

 //打印div
 function printDIV(){
            bdhtml = window.document.body.innerHTML;
            sprnstr = "<!--startprint-->";   
            eprnstr = "<!--endprint-->";
            prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17);
            prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
            window.document.body.innerHTML = prnhtml;
            window.print();
 }

这个只打印 <!--startprint-->  和 <!--endprint-->之间的东西

技术分享

技术分享

js实现页面的局部打印

标签:

原文地址:http://www.cnblogs.com/wushuishui/p/4743030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!