<head> <title>打印设置</title> <!-- 打印样式 --> <link rel="stylesheet" media="print" type="text/css" src="../bankprint.css" mce_src="bankprint.css" /> </head> <mce:script language="JavaScript"><!-- var hkey_root,hkey_path,hkey_key; hkey_root="HKEY_CURRENT_USER"; hkey_path="//Software//Microsoft//Internet Explorer//PageSetup//"; //配置网页打印的页眉页脚为空 function pagesetup_null(){ try{ 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_left"; //设置左页边距(10) RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.5"); hkey_key="margin_right"; //设置右页边距(10) RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.5"); }catch(e){} } //配置网页打印的页眉页脚为默认值 function pagesetup_default(){ try{ var RegWsh = new ActiveXObject("WScript.Shell"); hkey_key="header"; RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P") hkey_key="footer"; RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&u&b&d"); }catch(e){} } //打印选区内容 function doPrint() { pagesetup_null(); bdhtml=window.document.body.innerHTML; sprnstr="<!--startprint-->"; eprnstr="<!--endprint-->"; prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); window.document.body.innerHTML=prnhtml; window.print(); } //打印页面预览 function printpreview(){ pagesetup_null(); //wb.printing.header = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页"; //wb.printing.footer = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页"; try{ document.getElementById('wb').execwb(7,1); }catch(e){ alert("您的浏览器不支持此功能,请选择'文件'->'打印预览'"); } } //打印 function prints(){ pagesetup_null(); //wb.printing.header = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页"; //wb.printing.footer = "居左显示&b居中显示&b居右显示页码,第&p页/共&P页"; try{ document.getElementById('wb').execwb(6,1); }catch(e){ alert("您的浏览器不支持此功能"); } } // --></mce:script> <body> <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" id="wb" width="0" height="0"></OBJECT> <div id="bankwrap"> <span style="cursor:pointer; color:#0000FF" mce_style="cursor:pointer; color:#0000FF" οnclick="printpreview();">打印预览</span> <span style="cursor:pointer; color:#0000FF" mce_style="cursor:pointer; color:#0000FF" οnclick="prints();" class="Noprint">打印</span> </div> </body>