首页 > Web开发 > 详细

web打印功能

时间:2014-05-05 22:21:29      阅读:406      评论:0      收藏:0      [点我收藏+]

1.http://www.jb51.net/article/38083.htm

2。

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   
</head>
<body>
    <form id="form1" runat="server">
    <div id="PrintContent" runat="server">
        ASP.NET网页打印测试<br />
        内容内容内容内容内容内容内容内容内容内容内容内容内容<br />
        内容内容内容内容内容内容内容内容内容内容内容内容内容<br />
        内容内容内容内容内容内容内容内容内容内容内容内容内容<br />
        内容内容内容内容内容内容内容内容内容内容内容内容内容<br />
        内容内容内容内容内容内容内容内容内容内容内容内容内容<br />
        内容内容内容内容内容内容内容内容内容内容内容内容内容<br />
        内容内容内容内容内容内容内容<br />
    </div>
    <asp:Button ID="btnPrint" runat="server" Text="打印" OnClientClick="return PrintArticle();" />
    </form>
</body>
</html>
<script type="text/javascript">
    function PrintArticle() {
        var pc = document.getElementById("<%=PrintContent.ClientID%>");
        var pw = window.open(‘‘, ‘‘, ‘width=500,height=400‘); pw.document.write(‘<html>‘);
        pw.document.write(‘<head>‘); pw.document.write(‘<title>ASP.NET网页打印测试</title>‘); pw.document.write(‘</head>‘);
        pw.document.write(‘<body>‘); pw.document.write(pc.innerHTML); pw.document.write(‘</body>‘);
        pw.document.write(‘</html>‘); pw.document.close();
        setTimeout(function () {
            pw.print();
        }, 500); return false;
    }
    </script>

web打印功能,布布扣,bubuko.com

web打印功能

原文:http://www.cnblogs.com/kaiwanlin/p/3704843.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!