<head>
<style type="text/css" media="print">
DIV.d1 { DISPLAY: none }
</style>
</head>
<body>
打印可以这样实现(仅作简单示例):
也可把那个CAB文件下载到本地服务器再引用它.<br/>
在这里加入打印内容及控制分页............
<div class="d1">
<OBJECT id="MyPrinter" style="DISPLAY: none" codeBase="http:///scriptx/ScriptX.cab#Version=5,60,0,360"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" viewastext>
</OBJECT>
<SCRIPT defer>
function window.onload() {
MyPrinter.printing.header = ""
MyPrinter.printing.footer = ""
MyPrinter.printing.portrait=true
MyPrinter.printing.leftMargin =5
MyPrinter.printing.topMargin = 5
MyPrinter.printing.rightMargin = 1
MyPrinter.printing.bottomMargin = 1
//MyPrinter.printing.paperSize="Letter"
}
</SCRIPT>
<input style="WIDTH: 87px; HEIGHT: 24px" οnclick='document.execCommand("print")' type="button"
value="打印...">
<!-- <INPUT οnclick=MyPrinter.printing.Print(false) type=button value=打印本頁> -->
<input name="button" type="button" onClick="MyPrinter.printing.PageSetup()" value="页面设置">
<INPUT οnclick="MyPrinter.printing.Preview()" type="button" value="打印预览"> <br/>
</div>
</body>
</html>