使用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