用JS去掉打印的页眉页脚

 1 < script language = " JavaScript " >
 2 var  hkey_key;
 3 var  hkey_root = " HKEY_CURRENT_USER " ;
 4 var  hkey_path = " \\Software\\Microsoft\\Internet Explorer\\PageSetup\\ " ;
 5 // 设置网页打印的页眉页脚为空
 6 function  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 // 设置网页打印的页眉页脚为默认值
18 function  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 >

转载于:https://www.cnblogs.com/cnzhouhai/archive/2007/09/12/890844.html

你可能感兴趣的:(用JS去掉打印的页眉页脚)