jQuery簡單易用的網頁內容列印外掛程式

來源:互聯網
上載者:User

標籤:ext   select   boolean   option   地址   copy   src   value   iframe   

簡要教程

jQuery.print是一款簡單易容且功能強大的網頁內容列印。該網頁列印外掛程式可以列印指定地區的網頁元素,可以指定跳過不列印某些元素,還可以列印整個頁面內容。並且提供了豐富的列印參數設定。
 使用方法

使用該網頁列印外掛程式要引入jQuery和jquery.print.js檔案。
<script type="text/javascript" src="http://1112.www.qixoo.qixoo.com/js/jquery.min.js"></script>
<script type="text/javascript" src="http://1112.qkxue.net/js/jquery.print.js"></script>               

jQuery版本已經在1.7.2和1.9.1版本中做過測試。其它版本請自行測試。
 列印內容

可以像下面這樣使用來列印頁面內容。
$("#myElementId").print(/*options*/);

或者:
$.print("#myElementId" /*, options*/);               
 配置參數

你可以在調用列印方法時傳入一些參數:
$("#myElementId").print({
    globalStyles: true,
    mediaPrint: false,
    stylesheet: null,
    noPrintSelector: ".no-print",
    iframe: true,
    append: null,
    prepend: null,
    manuallyCopyFormValues: true,
    deferred: $.Deferred()
});               
參數     預設值     接收值     描述
globalStyles     true     Boolean     是否包含父文檔的樣式
mediaPrint     false     Boolean     是否包含media=‘print‘的連結標籤。會被globalStyles選項覆蓋
stylesheet     null     URL-string     外部樣式表的URL地址
noPrintSelector     ".no-print"     任何可用的jQuery選取器     不想列印的元素的jQuery選取器
iframe     預設true,如果沒有iframe選取器被傳入會建立一個隱藏的iframe     任何可用的jQuery選取器或Boolean     是否使用一個iframe來替代列印表單的快顯視窗
append/prepend     null     Boolean     是否將使用者更新的表單輸入框內容作為列印內容(通過迭代每一個表單元素來實現)

jQuery簡單易用的網頁內容列印外掛程式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.