打印~~

来源:互联网 发布:程序员十大软件 编辑:程序博客网 时间:2024/06/02 16:38

print.js

var hkey_key;var hkey_root="HKEY_CURRENT_USER";var hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";//设置网页打印的页眉页脚为空function pagesetup_null() {var RegWsh = new ActiveXObject("WScript.Shell");hkey_key="header";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");hkey_key="footer";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");hkey_key="margin_bottom";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"1"); //0.39相当于把页面设置里面的边距设置为10hkey_key="margin_top";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"1");hkey_key="margin_left";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.2"); hkey_key="margin_right";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.2");}function openPrint(){pagesetup_null();document.all.WebBrowser.ExecWB(7,1)//document.all.WebBrowser.ExecWB(6,1);}

<style type="text/css" media=print>.Noprint{display:none;}   .PageNext{page-break-after:   always;} </style>

<div align="center" style="padding-top:8px;"  class="Noprint"><a href="javascript:print()" class="list_button2"  id="打印" >打 印</a></div>