web| printing often needs scriptx.cab in Web printing, and here is the same, so the principle is the same, here will be a detailed description of how to control the printing problem.
There are 2 required files for printing:
1: Configuration file: Setting.js
2: Display files: print.js
Setting.js is as follows:
document.write ("<object id=\" factory\ "style=\" display:none\ "Viewastext classid=\" clsid : 1663ed61-23eb-11d2-b92f-008048fdd814\ "codebase=\" images/events/scriptx.cab#version=5,60,0,360\ "></ Object> ");
function Printers () {
Agree = confirm (' OK print? ');
if (agree) {
if (agree)
{
noprinter.style.visibility= ' hidden ';
Factory.printing.Print ();}
else noprinter.style.visibility= ' visible ';
}
}
Factory.printing.header = ""
Factory.printing.footer = ""
Factory.printing.leftMargin = 0.75
Factory.printing.topMargin = 0.75
Factory.printing.rightMargin = 0.75
Factory.printing.bottomMargin = 0.75
The file print.js appears as follows:
document.write (' <style media= print > @media print {. Noprint{display:none}} </style> ');
~ ~ Control the style of not displaying buttons when printing, you only need to reference the style where the page does not need to print
document.write (' <div id=noprinter name=noprinter align=right style= ' visibility:visible ' class= ' noprint ' >< Br> ');
document.write (' <input type=button Class=button value= off name= "Bfq" id= "Bfq" onclick=\ "Javascript\:window.close () \ ">");
document.write (' <input type= "button" value= "Print Setup" onclick=\ "Factory.printing.PageSetup () \" > ");
document.write (' <input type= "button" value= "Print Preview" onclick=\ "Factory.printing.Preview () \" > ");
document.write (' <input type=button name=button3 value= ' print ' > </div> ');
When using the print function, just include the file 2 files in the page where the Print button is placed, the code is as follows:
<script src= ". /inc/print/printer.js "></script>
<script src= ". /inc/print/printers.js "></script>