当前位置:首页 > iOS开发专区 > 正文内容

直接操作Window对象进行 打印 保存等操作

14年前 (2011-08-25)iOS开发专区10186

打印代码:
<SCRIPT language="JavaScript">
       function printdiv() {
     var newWin = window.open('printer', '', '');
     var titleHTML = document.getElementByIdx_x("printdiv").innerHTML;
     for(var i=0;i<2;i++){
      titleHTML = titleHTML.toString().replace("border=0", "border=1");
     }
     for(var i=0;i<2;i++){
      titleHTML = titleHTML.toString().replace("cellSpacing=1", "cellSpacing=0");
     }
     newWin.document.write(titleHTML);
     newWin.document.location.reload();
     newWin.print();
     newWin.close();
  WebBrowser.ExecWB(7, 1); //预览
  }
      
    </SCRIPT>
  <body>

    <input type="button" id="print" value="打印" onclick="javascript:printdiv();"/>
    <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
    <div id = "printdiv">
    <table width="80%" cellspacing="1" cellpadding="1"  bgcolor="#6CA6CD" border="0">
     <tr>
      <td>测试</td>
      <td>sdff</td>
     </tr>
     <tr>
      <td>sdff</td>
      <td>sdff</td>
     </tr>
     <tr>
      <td>sdff</td>
      <td>sdff</td>
     </tr>
    </table>
    </div>
  </body>


打开
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
另存为
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为><OBJECT

classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
属性
<input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性><OBJECT

classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
打印
<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>
页面设置
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置><OBJECT

classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
刷新
<input type=button value=刷新 name=refresh onclick="window.location.reload()">
导入收藏
<input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,);>
导出收藏
<input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,);>
加入收藏
<INPUT name=Button2 onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹>
整理收藏夹
<INPUT name=Submit2 onclick="window.external.ShowBrowserUI(OrganizeFavorites, null)" type=button value=整理收藏夹>
查看原文件
<INPUT name=Button onclick=window.location = "view-source:" + window.location.href type=button value=查看源文件>
语言设置
<INPUT name=Button onclick="window.external.ShowBrowserUI(LanguageDialog, null)" type=button value=语言设置>
前进
<INPUT name=Submit onclick=history.go(1) type=submit value=前进>
后退
<INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退>

扫描二维码推送至手机访问。

版权声明:本文由 果签工坊 发布,如需转载请注明出处。

本文链接:https://applep12.vip/programming/GgUFa2IBtlwGLnk.html

分享给朋友:
返回列表

没有更早的文章了...

下一篇:js直接操作access数据库

相关文章

js直接操作access数据库

<html>    <head><titel>jstest</title></head>    &l...

重新设置 Myeclipse workspace

启动不提示 “Workspace Launcher”对话框的情况下首次启动Eclipse/MyEclipse时, 会弹出"Workspace Launcher"对话框, 提示设置Workspace路径. 设定好路径后,...

初学extjs 了解的一些基本属性

1.  Ext.Msg.alert("角色管理信息提示", "角色权限保存成功!");2.  store.baseParams.jsonString = jso...

关于extjs组件中的内存泄露问题

所有component的子类都自动的参与标准的ext组件的生命周期:创建,渲染,销毁,这些操作由Container类提供。在创建容器时,组件可以通过item配置选项添加到容器中,或者可以add方法动态地添加。所有组件都注册到了ext.com...

8088汇编手册

一、数据传输指令 --------------------------------------------------------------------------------     它们在存贮器...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。