<script language=VBScript> 
dim hkey_root,hkey_path,hkey_key 
hkey_root="HKEY_CURRENT_USER" 
hkey_path="\Software\Microsoft\Internet Explorer\PageSetup" 
'//设置网页打印的页眉页脚为空 
function pagesetup_null() 
on error resume next 
Set RegWsh = CreateObject("WScript.Shell") 
hkey_key="\header" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"" 
hkey_key="\footer" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""  
hkey_key="\margin_bottom" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.2"
hkey_key="\margin_left" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.2" 
hkey_key="\margin_right" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.2" 
hkey_key="\margin_top" 
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"0.2" 
    eprint()
end function 
'//设置网页打印的页眉页脚为默认值 
</script><script language=javascript>
function eprint()
{
document.all.WebBrowser.ExecWB(7,1)} </script>
<input class=Noprint onclick=pagesetup_null() type=button value=打印预览 runat="server"> 上面是我设置的 。但是为什么没用啊 ??
请高手解答,急

解决方案 »

  1.   

    <script  language="JavaScript">   
    var HKEY_Root,HKEY_Path,HKEY_Key; 
    HKEY_Root="HKEY_CURRENT_USER"; 
    HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\"; 
    //设置网页打印的页眉页脚为空 
    function PageSetup_Null() 

     try 
     { 
             var Wsh=new ActiveXObject("WScript.Shell"); 
      HKEY_Key="header"; 
      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); 
      HKEY_Key="footer"; 
      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,""); 
     } 
     catch(e){} 

    //设置网页打印的页眉页脚为默认值 
    function  PageSetup_Default() 
    {   
     try 
     { 
      var Wsh=new ActiveXObject("WScript.Shell"); 
      HKEY_Key="header"; 
      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&w&b页码,&p/&P"); 
      HKEY_Key="footer"; 
      Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"&u&b&d"); 
     } 
     catch(e){} 

    </script> 
    <input type="button" value="清空页码" onclick=PageSetup_Null()> 
    <input type="button" value="恢复页码" onclick=PageSetup_Default()> 
      

  2.   

    xiexie。/OK。//THANK YOU 很MUCH