页面打印
//注册表路径
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_key1="header";
hkey_key2="footer";
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key1,"");
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key2,"");
}catch(e)...{}
}
//设置页眉页脚为默认值
function PageSetup_Default()
...{
try...{
var RegWsh = new ActiveXObject("WScript.Shell") ;
hkey_key1="header";
hkey_key2="footer";
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key1,"&w&b页码,&p/&P");
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key2,"&u&b&d");
}catch(e)...{}
}
function printReport()...{
PageSetup_Null();//设置页眉页脚为空
window.print();//打印页面
PageSetup_Default();//设置页眉页脚为默认值
}
方法2:
style设置
@media print
{
.Noprint{DISPLAY:none;}
.PageNext{PAGE-BREAK-AFTER:always}
}
在不打印的内容中加上 class="Noprint"