zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    【转载】消息队列使用的四种场景介绍
    Vue项目部署打包
    创建Vue项目vue-cli &#183; Failed to download repo vuejs-templates/webpack: connect ETIMEDOUT
    数据库错误:ORA-12154
    oracle数据库一条sql语句批量插入数据
    Linux time scap
    winscp不能使用root登录
    Linux find ./ -name *.bak | xargs rm -rf
    Linux命令echo 3 > /proc/sys/vm/drop_caches
    redis查看服务器占用端口
  • 原文地址:https://www.cnblogs.com/ajun/p/2316554.html
Copyright © 2011-2022 走看看