js打印去掉网址和日期

  var hkey_root,hkey_path,hkey_key;   
  hkey_root="HKEY_CURRENT_USER";   
  hkey_path="//Software//Microsoft//Internet Explorer//PageSetup//";

  function   pagesetup_null(){   
          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,"");   
  }   
 //  默认
  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){}
  }

2.  嵌入打印
function printit(){ 
    if (window.print) {
        window.print() ; 
    } else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = ""; 
    }
 }

你可能感兴趣的:(function,object,header,dialog,Path,WebBrowser)