没有啊!我用WebBrowser.ExecWB(6, 6)没有提示啊,是不是你的机器有问题

解决方案 »

  1.   

    <object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"> 
    </object> 
    <OBJECT id=closes type=application/x-oleobject 
    classid=clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11><param name=Command value=Close></object> 
    <SCRIPT> 
    function window.onbeforeprint(){ 
    //alert("打印前事件"); 
    parent.iprint.style.display="none";

    function window.onafterprint(){ 
    //alert("打印后事件"); 
    closes.Click(); 
    parent.iprint.style.display="";
    }
    function cmdPrint()
    {
    document.all.WebBrowser.ExecWB(6,6);
    }
    function cmdPrintPreview()
    {
    document.all.WebBrowser.ExecWB(7,0);
    }
    function cmdPrintPageSetup()
    {
    document.all.WebBrowser.ExecWB(8,0); 
    }
    function cmdExport()
    {
    document.all.WebBrowser.ExecWB(4,2,".xls");
    }function test()
    {
    alert("hello");
    }
    </SCRIPT>
    <html>
    <head>
    </head>
    <title>
    </title>
    <body topmargin=0>
    <table width=100%>
    <tr>
    <td width=100% align=right>
    <input name=Button onClick=cmdPrintPageSetup() type=button value=页面设置> 
    <input name=Button onClick=cmdPrintPreview() type=button value=打印预览> 
    <input name=Button onClick=cmdPrint() type=button value=开始打印> 
    <input name=Button onClick=cmdExport() type=button value="页面另存为"> 
    </td>
    </tr>
    </table> 
    </body>
    </html>
      

  2.   

    没错,在本地双击运行这人HTML文件是没有问题,但是通过IIS建立站点后就不行了.
    如用这样的方式访问:
    http://127.0.0.1/myweb/print.htm
    http://127.0.0.1/myweb/print.asp