用JS去掉打印的页眉页脚
1<script language="JavaScript">
2var hkey_key;
3var hkey_root="HKEY_CURRENT_USER";
4var hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
5//设置网页打印的页眉页脚为空
6function pagesetup_null()
7{
8
9 var RegWsh = new ActiveXObject("WScript.Shell");
10 hkey_key="header";
11 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
12 hkey_key="footer";
13 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
14
15}
16
17//设置网页打印的页眉页脚为默认值
18function pagesetup_default()
19{
20 try{
21 var RegWsh = new ActiveXObject("WScript.Shell");
22 hkey_key="header";
23 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P");
24 hkey_key="footer";
25 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&u&b&d");
26 }catch(e){}
27}
28</script>
2var hkey_key;
3var hkey_root="HKEY_CURRENT_USER";
4var hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
5//设置网页打印的页眉页脚为空
6function pagesetup_null()
7{
8
9 var RegWsh = new ActiveXObject("WScript.Shell");
10 hkey_key="header";
11 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
12 hkey_key="footer";
13 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
14
15}
16
17//设置网页打印的页眉页脚为默认值
18function pagesetup_default()
19{
20 try{
21 var RegWsh = new ActiveXObject("WScript.Shell");
22 hkey_key="header";
23 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P");
24 hkey_key="footer";
25 RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&u&b&d");
26 }catch(e){}
27}
28</script>