在IE里面直接使用打印功能

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 yohomonkey 的 blog

        相信用过web开放的朋友们都碰到过在ie浏览器中,产生打印功能的情况,不少时候需要借助其他的第三方报表工具来实现,例如水晶,但是大家多会发现其设置是比较麻烦的,像一些简单的打印,设置起来反而麻烦。这里给出一个在ie中直接打印的例子,不使用水晶和其他的报表工具,直接利用ie进行打印。
        详细代码如下:
文件名:打印文本文档.html
代码:
<html>
  <head>
  <title>打印</title>
</head>
 <body>
  <form>
  <style media='print'>
   .noprint { display: none }
   .pagenext { page-break-after: always }
  </style>
   <table  cellspacing="0" cellpadding="0" align="center" border="0">
    <tr class="itemstyle">
     <td class="title">2004年11月26日</td>
    </tr>
   </table>
      
<center class=noprint ><hr size=1><object  id=webbrowser  classid=clsid:8856f961-340a-11d0-a96b-00c04fd705a2  height=0  width=0></object><input  type=button  value=打印      onclick=document.all.webbrowser.execwb(6,1)><input  type=button  value=直接打印  onclick=document.all.webbrowser.execwb(6,6)><input  type=button  value=页面设置  onclick=document.all.webbrowser.execwb(8,1)><input  type=button  value=打印预览  onclick=document.all.webbrowser.execwb(7,1)><input  type=button  value=关闭  onclick=window.close();></center>

   </form>
 </body>
</html>

大家可以在页面上添加一些空间和数据运行试试!

本文关键:在IE里面直接使用打印功能
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top