First Step:
Jquery. Printarea.js Download
JS Reference
Copy Code code as follows:
<script language= "javascript" src= "Jquery-1.7.1.min.js" ></script>
<script type= "Text/javascript" src= "jquery." Printarea.js "></script>
HTML Reference:
Copy Code code as follows:
<div class= "My_show" >
This is displayed when printed.
</div>
<div class= "My_hidden" >
This is hidden when printing.
</div>
<input type= "button" id= "Print"/>
JavaScript code:
Copy Code code as follows:
$ (document). Ready (function () {
$ ("#print"). Click (function () {
$ (". My_show"). PrintArea ();
});
});
The plugin also provides some parameters to configure, using the method: $ (Element). PrintArea (option).
This method I have not used, we try to be, there is a problem message ha.
parameter Settings:
1.mode: Mode, when clicked on the Print button trigger mode, the default is IFRAME, when set to popup will open a new window page print.
2.popTitle: Set the title of the newly opened window, the default is null.
3.popClose: Closes the window when finished printing, and defaults to false.