web打印去掉url地址


<script language="javascript" type="text/javascript">
        function UserPrint()
        {
          bdhtml=window.document.body.innerHtml; 
        
          var headstr = "<html><head></head><body>";
          var footstr = "</body>"; 
          var bodystr = document.all.item("printDiv").innerHTML;                     
          var oldstr = document.body.innerHTML; 
              
          document.body.innerHTML = headstr + bodystr + footstr;  
          pagesetup_null();     
          window.print();          
          pagesetup_default();
          document.body.innerHTML = oldstr;
          return false;   
        }               

        var hkey_root,hkey_path,hkey_key
        hkey_root="HKEY_CURRENT_USER"
        hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\"
        //設置網頁打印的頁眉頁腳為空
        function pagesetup_null(){
            try{
                var RegWsh = new ActiveXObject("WScript.Shell")
                hkey_key="header"
                RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
                hkey_key="footer"
                RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"")
            }catch(e){}
        }
        //設置網頁打印的頁眉頁腳為默認值
        function pagesetup_default(){
            try{
                var RegWsh = new ActiveXObject("WScript.Shell")
                hkey_key="header"
                RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&w&b頁碼,&p/&P")
                hkey_key="footer"
                RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&u&b&d")
            }catch(e){}
        }
    </script>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM