Php implements the print preview function, and php implements print preview.

Source: Internet
Author: User

Php implements the print preview function, and php implements print preview.
<Inputid = "btnPrint" type = "button" value = "print" onclick = "javascript: window. print (); "/> <inputid =" btnPrint "type =" button "value =" print preview "onclick = preview (1) /> <styletype = "text/css" media = print>. noprint {display: none }</style> <pclass = "noprint"> areas that do not need to be printed </p> <script> functionpreview (outputs) {if (then <102.1620.bdhtml#20.20.doc ument. body. innerHTML; // obtain the html code sprnstr = "<! -Startprint "+ print +"-> "; // you can specify eprnstr =" <! -Endprint "+ outputs +"-> "; // set the print end area prnhtml = bdhtml. substring (bdhtml. indexOf (sprnstr) + 18); // obtain htmlprnhtmlprnhtml = prnhtml from the start code. substring (0, prnhtml. indexOf (eprnstr); // obtain html?document.body.innerhtml=prnhtml###print({windowindow.doc ument. body. innerHTML = bdhtml;} else {window. print () ;}</script> <p> XXXXX </p> <! -Startprint1-> content to be printed <! -Endprint1-> <inputid = "btnPrint" type = "button" value = "print" onclick = "javascript: window. print (); "/> <inputid =" btnPrint "type =" button "value =" print preview "onclick = preview (1) /> <styletype = "text/css" media = print>. noprint {display: none }</style> <pclass = "noprint"> areas that do not need to be printed </p> <script> functionpreview (outputs) {if (then <102.1620.bdhtml#20.20.doc ument. body. innerHTML; // obtain the html code sprnstr = "<! -Startprint "+ print +"-> "; // you can specify eprnstr =" <! -Endprint "+ outputs +"-> "; // set the print end area prnhtml = bdhtml. substring (bdhtml. indexOf (sprnstr) + 18); // obtain htmlprnhtmlprnhtml = prnhtml from the start code. substring (0, prnhtml. indexOf (eprnstr); // obtain html?document.body.innerhtml=prnhtml###print({windowindow.doc ument. body. innerHTML = bdhtml;} else {window. print () ;}</script> <p> XXXXX </p> <! -Startprint1-> content to be printed <! -Endprint1->

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.