<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就怎么也打不出来

解决方案 »

  1.   

    你这个函数在什么地方调用呢?那打印下异常信息, 看会不会显示
    catch(e){alert(e);}
      

  2.   

    var RegWsh = new ActiveXObject("WScript.Shell");  WScript.Shell 有可能这个被禁止了
      

  3.   

    试试
    regsvr32 wshom.ocx
    regsvr32 shell32.dll
      

  4.   

    lz先在catch(e){alert(e)}中alert一下异常信息吧。
    估计是新建var RegWsh = new ActiveXObject("WScript.Shell"); 对象的时候出错。
    修改一下IE的安全设置就可以了  
      

  5.   

    我也遇到这个问题了,楼主解决了吗,在html网页里没问题,到了jsp里就异常了
      

  6.   

    没有权限,除非你要在webbrowser或者hta下运行,不过你已经说了是jsp,要是自己的系统地话,你再开发了浏览器(webbrowser)的...要是网站就算了,别做这个了