標籤: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簡單易用的網頁內容列印外掛程式