zoukankan      html  css  js  c++  java
  • web打印功能

    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>

  • 相关阅读:
    按升序合并如下两个list, 并去除重复的元素
    python数据结构
    驼峰式命名改下划线命名
    求某个数出现的次数超过了总数的一半
    翻转字符串
    复习
    RESTful
    Flask wtforms
    数据库连接池(DBUtils)
    iOS
  • 原文地址:https://www.cnblogs.com/kaiwanlin/p/3704843.html
Copyright © 2011-2022 走看看