基於jauery的網頁列印功能

2021-09-14 06:31:01 字數 830 閱讀 1746

window自帶print方法:window.print(),能夠實現網頁列印。然而有時候,我們並不想整個網頁列印,而是頁面中的某一部分實現列印功能,這個時候,我們便可使用下面方法。
大致實現方式就是,建立iframe標籤,把想要列印的部分填充的建立的iframe中,然後呼叫window的print方法,實現需求。
(function($) , $.fn.jqprint.defaults, options);

var $element = (this instanceof jquery) ? this : $(this);

if (opt.operasupport && $.browser.opera)

else

); }

var doc = $iframe[0].contentwindow.document;

}if (opt.importcss));}

else );}

}if (opt.printcontainer)

else ); }

doc.close();

(opt.operasupport && $.browser.opera ? tab : $iframe[0].contentwindow).focus();

settimeout( function() }, 1000);

}$.fn.jqprint.defaults = ;

jquery.fn.outer = function()

})(jquery);

$('#div').jqprint();

基於xoops頁面列印功能

其次 在自己的列印頁面新增列印鏈結位址,例如列印 在transfer.php檔案中需要設定乙個陣列引數 date data array data res id res id data uid uid data class id class id data url xoops url modules ...

基於bootstrap的網頁開發

1.html5shiv.js的作用是?html5shiv主要解決html5提出的新的元素不被ie6 8識別,這些新元素不能作為父節點包裹子元素,並且不能應用css樣式。讓css 樣式應用在未知元素上只需執行 document.createelement elementname 即可實現。html5s...

VC 基於文件的列印

列印過程 onprepareprinting 函式進行列印中一些資訊的設定。onbeginprinting 函式建立列印資源。onpreparedc 函式設定具體列印一頁時的資訊。呼叫onprint 函式列印一頁。1 在利用嚮導生成單文件和多文件應用程式的過程中,使用者可以選擇應用程式是否支援列印和...