zoukankan      html  css  js  c++  java
  • js打印

    function printThis(){
    //    console.log(jQuery("#if1",parent.window.document));
    //    alert(window.parent.document.frames['if1']);
       if (!!window.ActiveXObject || "ActiveXObject" in window){
    //        alert(window.parent.frames['if1']);
    //        alert("IE");
            var bdhtml=window.document.body.innerHTML;
            var sprnstr="<!--startprint-->"; //开始打印标识字符串有17个字符
            var eprnstr="<!--endprint-->"; //结束打印标识字符串
            var prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); //从开始打印标识之后的内容
            var prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容
            window.document.body.innerHTML=prnhtml; //把需要打印的指定内容赋给body.innerHTML
            window.parent.document.frames['if1'].focus();
    //        jQuery("#if1",window.parent.document).focus();
    //        window.frames['if1'].focus();
    //        document.execCommand('print', false, null);
            print(); //调用浏览器的打印功能打印指定区域
            window.document.body.innerHTML=bdhtml;//重新给页面内容赋值;
        }else{
    //        $("#wrap").jqprint();
    //        alert(window.frames['if1']);
            var bdhtml=window.document.body.innerHTML;
            var sprnstr="<!--startprint-->"; //开始打印标识字符串有17个字符
            var eprnstr="<!--endprint-->"; //结束打印标识字符串
            var prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); //从开始打印标识之后的内容
            var prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容
            window.document.body.innerHTML=prnhtml; //把需要打印的指定内容赋给body.innerHTML
            window.print(); //调用浏览器的打印功能打印指定区域
            window.document.body.innerHTML=bdhtml;//重新给页面内容赋值;
        }
    }
  • 相关阅读:
    小小不爽一下
    银行家算法的讨论
    【转】C字符串处理函数的实现
    Oracle物理存储结构文件
    RAC和ASM环境下修改控制文件control file
    TNS01190: The user is not authorized to execute the requested listener comm (oracle”用户没有启动lisener的权限?)
    RAC环境ASM存储新增控制文件的方法
    Oracle RAC 修改 spfile 文件位置
    Rman通过duplicate创建standby
    rman恢复手册
  • 原文地址:https://www.cnblogs.com/web520/p/6879386.html
Copyright © 2011-2022 走看看