使用JS調用瀏覽器的打印功能


一、使用插件

1.jquery.jqprint-0.3.js

二、編寫HTML文件

<script src="./js/jquery-3.1.1.min.js"></script>
<script src="./js/jquery.jqprint-0.3.js"></script>
<script src="./js/print.js"></script>

<div>
    <span id="download">打印</span>
</div>
<div class="data-table" id="download-table">
   <table class="table table-hover">
      <thead>
         <tr>
            <td>項目員</td>
            <td>任務分值</td>
            <td>日志分值</td>
            <td>績效分值</td>
            <td>績效額度</td>
         </tr>
      </thead>
   </table>
</div>

三、編寫js文件

$(function () {
    $("#print").click(function () {
        $( '#download-table' ).jqprint({
            debug: false,
            importCSS: true,
            printContainer: true,
            operaSupport: false
        });
    });
})


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM