用第三方控件<object id="factory" style="display:none" viewastext
  classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
  codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"
></object><input type=button value=页面设置 onclick="factory.printing.PageSetup()">
<input type=button value=打印预览 onclick="factory.printing.Preview()">
 
<script language=javascript>
function window.onload()
{
   // -- advanced features
   factory.printing.SetMarginMeasure(2) // measure margins in inches
   factory.printing.SetPageRange(false, 1, 3) // need pages from 1 to 3
   factory.printing.printer = "HP DeskJet 870C"
   factory.printing.copies = 2
   factory.printing.collate = true
   factory.printing.paperSize = "A4"
   factory.printing.paperSource = "Manual feed"   // -- basic features
   factory.printing.header = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页"
   factory.printing.footer = "(自定义页脚)"
   factory.printing.portrait = false
   factory.printing.leftMargin = 0.75
   factory.printing.topMargin = 1.5
   factory.printing.rightMargin = 0.75
   factory.printing.bottomMargin = 1.5
}
function Print(frame) {
  factory.printing.Print(true, frame) // print with prompt
}
</script>
<input type=button value="打印本页" onclick="factory.printing.Print(false)">
<input type=button value="页面设置" onclick="factory.printing.PageSetup()">
<input type=button value="打印预览" onclick="factory.printing.Preview()"><br>

解决方案 »

  1.   

    我觉得第三方控件也好,本地也好,
    网页打印反正比较麻烦我一般是通过转换
    将之形成DOC或XLS后再打印的
      

  2.   

    为何我用
    <object id="factory" style="display:none" viewastext
      classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
      codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"
    ></object>
    这个方法时,页面上会报错,
    提示factory.printing为空或不是对象?