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>

  • 相关阅读:
    一些个人看到觉得还不错的资料,现在先把记得的保存下来,以后碰到会继续更新
    鼠标 mouseover和mouseout事件
    phpqrcode 生成二维码
    django url路径与模板中样式相对路径的问题
    js parseInt和map函数
    WebService 布置简单的计算器
    java ++的使用
    java 运算符
    Java的概念
    public 有跟没有的区别
  • 原文地址:https://www.cnblogs.com/kaiwanlin/p/3704843.html
Copyright © 2011-2022 走看看