DIV CSS 佈局教程網

jQuery PrintArea 插件實現網頁區域列印
編輯:JQuery特效代碼     

PrintArea 列印思路

PrintArea 插件可只列印頁面中指定區域,而不是整個視窗。適合報表、訂單、收據與證書頁面。

基本用法

<script src="jquery-1.7.1.min.js"></script>
<script src="jquery.PrintArea.js"></script>

<div class="my_show">這個是列印時顯示的。</div>
<div class="my_hidden">這個是列印時隱藏的。</div>
<input type="button" id="print" />

<script>
$(document).ready(function () {
  $("#print").click(function () {
    $(".my_show").printArea();
  });
});
</script>

參數說明

  • mode:預設 iframe,也可設為 popup 以新視窗列印。
  • popTitle:新視窗標題。
  • popClose:列印完成後是否關閉視窗。

使用時應確認列印樣式表已載入,並避免將互動元件放入列印區域,以免輸出結果與畫面預期不同。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved