⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webprint.js

📁 本程序使用C#开发
💻 JS
字号:
// JScript 文件,
/*
调用以下单击函数的时候,要在  body 下写入以下的语句:
<object   id="WebBrowser"   width=0   height=0   classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">   </object>  
*/
//打印时调用
function print_onclick() {
//window.print();
document.all.WebBrowser.ExecWB(6,1);
}
//预览时调用
function preview_onclick() {
//document.focus();
//document.getElementById("WebBrowser").ExecWB(7,1); 
//parent.main.focus();
//window.parent.frames("FrameClient").main.WebBrowser.ExecWB(7,1);
document.all.WebBrowser.ExecWB(7,1);
//window.parent.frames["FrameClient"].focus();
//window.parent.frames["FrameClient"].WebBrowser.ExecWB(7,1);
//printPreview();
}
//页面设置时调用
function setprint_onclick() {
document.all.WebBrowser.ExecWB(8,1);
}
function printPreview()       
  {   
      try   
      {   
          var   printWindow   =   window.open("","_blank");   
				printWindow.resize(200,200); ? 
          var   str   =   "<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2   height=0   width=0 VIEWASTEXT></OBJECT>"   
          var   s   =   "<html>\r\n";   
          s   +=   "<head>";   
          s   +=   "<meta   http-equiv='Content-Type'   content='text/html;   charset=gb2312'>";  
          s   +=   "<LINK media='print' href='js/PrintStyleSheet.css' type='text/css' rel='stylesheet'>\r\n<LINK media='screen' href='js/screanStyle.css' type='text/css' rel='stylesheet'>";
          s   +=   "</head>";   
          s   +=   "<body><center><br>";
          s   +=   document.form1.innerHTML;   
          s   +=   "</center></body>";   
          s   +=   "</html>";   
          printWindow.document.write(s); 
          printWindow.document.close();   
          printWindow.document.body.insertAdjacentHTML("beforeEnd",str);   
          printWindow.document.all.WebBrowser.ExecWB(7,1);   
          printWindow.close();
  
      }   
      catch(e)   
      {   
          alert("您的浏览器版本太低,请升级您的浏览器!");   
      }   
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -