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

.net打印

时间:2015-07-24 20:10:03      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:

<input type="button" onclick="javascript:printit()"></input>//打印整个html网页.

//打印局部html网页 extjs中的例子

 bdhtml = window.document.body.innerHTML;
    startprint = ("<div>");
    endprint = ("</div>");
    printhtml = bdhtml.substr(bdhtml.indexOf(startprint) );
    printhtml = printhtml.substr(0, printhtml.indexOf(endprint));
    window.document.write(‘<html>‘);
    window.document.write(‘<head>‘);
    window.document.write(‘<title>打印列表</title>‘);
    window.document.write(‘</head>‘);
    window.document.write(‘<body><from>‘);
    window.document.write(printhtml);
    window.document.write(‘<from></body>‘);
    window.document.write(‘</html>‘);
    window.print();
    window.location.reload();//加载页面

 

.net打印

标签:

原文地址:http://www.cnblogs.com/sdya/p/4674172.html

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