Home >Web Front-end >JS Tutorial >Various front-end printing methods on the web: jquery printing plug-in PrintArea realizes web page printing_jquery

Various front-end printing methods on the web: jquery printing plug-in PrintArea realizes web page printing_jquery

WBOY
WBOYOriginal
2016-05-16 17:44:032592browse
The first step:
jquery.PrintArea.js download
js reference
Copy code The code is as follows:



html quote :
Copy code The code is as follows:


This is displayed when printing.


This is hidden when printing.



javascript code:
Copy code The code is as follows:

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

This plug-in also It provides some configurable parameters. The method used is: $(element).printArea(option).
I have never used this method myself. Please try it. Please leave a message if you have any questions.

Parameter settings:
1.mode: mode, the mode is triggered when the print button is clicked, the default is iframe, when set to popup, a new window page will be opened for printing.
2.popTitle: Set the title of the newly opened window, which is empty by default.
3.popClose: Whether to close the window after completing printing, the default is false.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn