PHP implementation of print preview function
<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" > Where to Print </p><script>functionpreview (oper) {if (oper <10) { bdhtml=window.document.body.innerhtml;//gets the HTML code of the current page sprnstr= "<!–startprint" +oper+ "–>";//Set Print start area eprnstr= "<!–endprint" +oper+ "–>";//Set Print End Area prnhtml=bdhtml.substring (Bdhtml.indexof (SPRNSTR) +18);// Take Htmlprnhtmlprnhtml=prnhtml.substring (0,prnhtml.indexof (EPRNSTR)) backwards from the start code;// Take htmlwindow.document.body.innerhtml=prnhtml;window.print from the end Code (); window.document.body.innerhtml=bdhtml;} else {window.print ();}} </script><p>XXXXX</p><!–startprint1–> What to print <!–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" > places where printing is not required </p> <script>functionpreview (Oper) {if (oper <10) {bdhtml=window.document.body.innerhtml;//Gets the HTML code of the current page sprnstr = "<!–startprint" +oper+ "–>";//Set Print start area eprnstr= "<!–endprint" +oper+ "–>";//Set Print End area prnhtml= Bdhtml.substring (Bdhtml.indexof (SPRNSTR) +18);//From the start code back to Htmlprnhtmlprnhtml=prnhtml.substring (0,prnhtml.indexof ( EPRNSTR));//Htmlwindow.document.body.innerhtml=prnhtml;window.print from the End Code (); window.document.body.innerhtml= bdhtml;} else {window.print ();}} </script><p>XXXXX</p><!–startprint1–> What to print <!–endprint1–>
PHP implementation of print preview function