zoukankan      html  css  js  c++  java
  • 网页局部打印

     
    <div>文件头部,不打印出来的内容。。。</div>
    <div>文件头部,不打印出来的内容。。。</div>
    <div>文件头部,不打印出来的内容。。。</div>
    <!--startprint-->
    <div>这是被打印出来的内容</div>
    <div>这是被打印出来的内容</div>
    <div>这是被打印出来的内容</div>
    <div>这是被打印出来的内容</div>
    <!--endprint-->
    <div>文件尾部,不打印出来的内容。。。</div>
    <div>文件尾部,不打印出来的内容。。。</div>
    <div>文件尾部,不打印出来的内容。。。</div>
    <input type="button" name="print" value="预览并打印" onclick="preview()">
    function preview() {
    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();
    }
  • 相关阅读:
    WLAN 802.11 a/b/g PHY Specification and EDVT Measurement III
    L233
    L232 No methane on Mars
    leetcode 38 Count and Say ---java
    海量字符串查找——bloom filter,c
    leetcode 37 Sudoku Solver java
    mount --bind使用方法
    ECS API
    Linux挂载磁盘
    ECS简述
  • 原文地址:https://www.cnblogs.com/chenzeyongjsj/p/7239636.html
Copyright © 2011-2022 走看看