<script language="javascript">var hkey_root,hkey_key;
hkey_root="HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
alert(hkey_root);
//设置页眉页脚为空
function PageSetup_Null(){
try{
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key1="header";
hkey_key2="footer";
alert('3');
RegWsh.RegWrite(hkey_root+hkey_key1,"");
RegWsh.RegWrite(hkey_root+hkey_key2,"");
alert('1');
}catch(e){}
}
</script>alert(hkey_root)能打印出来,3就怎么也打不出来
hkey_root="HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
alert(hkey_root);
//设置页眉页脚为空
function PageSetup_Null(){
try{
var RegWsh = new ActiveXObject("WScript.Shell");
hkey_key1="header";
hkey_key2="footer";
alert('3');
RegWsh.RegWrite(hkey_root+hkey_key1,"");
RegWsh.RegWrite(hkey_root+hkey_key2,"");
alert('1');
}catch(e){}
}
</script>alert(hkey_root)能打印出来,3就怎么也打不出来
catch(e){alert(e);}
regsvr32 wshom.ocx
regsvr32 shell32.dll
估计是新建var RegWsh = new ActiveXObject("WScript.Shell"); 对象的时候出错。
修改一下IE的安全设置就可以了