打印网页时去掉页眉页脚

 1<script language="JavaScript">   
 2var hkey_root,hkey_path,hkey_key   
 3hkey_root="HKEY_CURRENT_USER"   
 4hkey_path="\\\Software\\\Microsoft\\\Internet Explorer\\\PageSetup\\\"   
 5//设置网页打印的页眉页脚为空   
 6function pagesetup_null(){   
 7try{   
 8var RegWsh = new ActiveXObject("WScript.Shell")   
 9hkey_key="header"   
10RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")   
11hkey_key="footer"   
12RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")   
13}catch(e){}   
14}   
15//设置网页打印的页眉页脚为默认值   
16function pagesetup_default(){   
17try{   
18var RegWsh = new ActiveXObject("WScript.Shell")   
19hkey_key="header"   
20RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P")   
21hkey_key="footer"   
22RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&u&b&d")   
23}catch(e){}   
24}   
25</script>
1<input onclick="pagesetup_null()" type="button" value="清空页码"/>
1<input onclick="pagesetup_default()" type="button" value="恢复页码"/>
Published At
Categories with 网页设计
Tagged with
comments powered by Disqus