js calls iframe to implement the method of printing page content_jquery
WBOY
Release: 2016-05-16 16:57:10
Original
1784 people have browsed it
1. Program description
1) This program can select an area on the page to print and print in iframe mode; 2) The difference from the original print() is that it cancels printing The content of the currently visited page can be completely retained after the page.
function do_print(id_str)//id-str print area id { var el = document.getElementById(id_str); var iframe = document.createElement('IFRAME'); var doc = null; iframe.setAttribute(' style', 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;'); document.body.appendChild(iframe); doc = iframe.contentWindow. document; //Introducing the proprietary CSS style for printing, www.111Cn.net modifies it according to the actual situation doc.write(""); doc.write('
If you want to achieve area printing, we can try the following method
The following article shares a super simple method to realize the printing function of the page. It can not only print the entire page, but also print a certain area of the page
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