用一个隐藏的 iframe 打开它,就可以随意操作了

解决方案 »

  1.   

    同意: bencalie(Bencalie) 的
      

  2.   

    在a中使用iframe,iframe的url为b.jsp;
    在页面加载的时候,设置b.body.style.diaplay="none";//隐藏;
    当在a中打印事件中写
    function printb(){
        document.frames["iframename"].focus();  //b页面获得焦点
        document.frames["iframename"].document.body.style.display=""; //显示
        document.frames["iframename"].print();  //打印
        document.frames["iframename"].document.body.style.display="none";//隐藏}
      

  3.   

    为什么不让用?这不是很好吗!Seeko0(阿 枫) 已经解决了啊
      

  4.   

    我要的是打印预览窗口呀
    不是print()
      

  5.   

    <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0>
      </OBJECT> 
      <input onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开 name=Button1>
      <input onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为 name=Button2>
      <input onclick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性 name=Button3>
      <input onclick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印 name=Button>
      <input onclick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览name=Button>
      <input onclick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置 name=Button4>
      <br/>
      <input onclick=window.location.reload() type=button value=刷新 name=refresh>
      <input onclick="window.external.ImportExportFavorites(true,'');" type=button value=导入收藏夹 name=Button5>
      <input onclick="window.external.ImportExportFavorites(false,'');" type=button value=导出收藏夹 name=Button32>
      <input onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹 name=Button22>
      <br/>
      <input onclick="window.external.ShowBrowserUI('OrganizeFavorites', null)" type=button value=整理收藏夹 name=Submit2>
      <input onclick='window.location="view-source:" + window.location.href' type=button value=查看源文件 name=Button7>
      <input onclick="window.external.ShowBrowserUI('LanguageDialog', null)" type=button value=语言设置 name=Button6>
      <input onclick=history.go(1) type=submit value=前进 name=Submit>
      <input onclick=history.go(-1) type=submit value=后退 name=Submit2>
      

  6.   

    你要预览非要使用ActiveX控件不可,也可以先不执行打印操作,只显示,点击打印再进行打印
      

  7.   

    <input onclick=document.all.WebBrowser.ExecWB(7,1) type=button value=打印预览name=Button>上面的预览功能不行