ie6自带的webbrowser object好像可以

解决方案 »

  1.   

    使用webbrowser控件,然后调用execwb(6,1);就可以搞定!
      

  2.   

    我就是这么用的,出来打印机选择弹出窗口。
    -----------------
    <input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT> -----------------
      

  3.   

    var margin_top,margin_bottom,margin_left,margin_right,footer,header
    var regedit = new ActiveXObject("WScript.Shell");
    function print_begin(){
    margin_top=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top");
    margin_bottom=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom");
    margin_left=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left");
    margin_right=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right");
    //footer=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer");
    //header=regedit.RegRead ("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header"); regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top",print_top);
    regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom",print_bottom);
    regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left",print_left);
    regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right",print_right);
    //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer",print_footer);
    //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header",print_header);
    }
    function print_end(){
    regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_top",margin_top);
    regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_bottom",margin_bottom);
    regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_left",margin_left);
    regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\margin_right",margin_right);
    //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\footer",footer);
    //regedit.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\header",header);
    }
      

  4.   

    document.all.WebBrowser.ExecWB(6,1)改成document.all.WebBrowser.ExecWB(6,6)
      

  5.   

    <object id="Factory" style="display:none" viewastext
    codeBase=http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360
    classid=clsid:1663ed61-23eb-11d2-b92f-008048fdd814 viewastext>
    </object>
    <input type="button" value="打    印" onclick="Factory.printing.Print(true)">
    <input type="button" value="页面设置" onclick="Factory.printing.PageSetup()">
    <input type="button" value="打印预览" onclick="Factory.printing.Preview()">
    <input type="button" value="横向设置" onclick="SetPrintSettings()">
    <script>
    function SetPrintSettings()

    try
    {
    Factory.printing.SetMarginMeasure(2);
    Factory.SetPageRange(false,1,3);
    Factory.printing.printer="HP DeskJet 870C";
    Factory.printing.copies=2;
    Factory.printing.collate=true;
    Factory.printing.paperSize="A4";
    Factory.printing.paperSource="Manual feed";

    Factory.printing.header="This is MeadCo";
    Factory.printing.footer="Advanced Printing by ScriptX";
    Factory.printing.portrait=false;
    Factory.printing.leftMargin=1.0;
    Factory.printing.topMargin=1.0;
    Factory.printing.rightMargin=1.0;
    Factory.printing.bottomMargin=1.0;
    }
    catch(e)
    {}

    </script>