当前位置:编程学习 > JS >>

JS 分页批量打印解决方案(只支持IE)

1 <html>
 2 <title>JS 分页批量打印解决方案(只支持IE)</title>
 3 <script language="javascript">        
 4  function printWithAlert() {      
 5  document.all.WebBrowser.ExecWB(6,1);   
 6  }    
 7  function printWithoutAlert() {     
 8    document.all.WebBrowser.ExecWB(6,6);    
 9  }  
10  function printSetup() {      
11  document.all.WebBrowser.ExecWB(8,1);    
12  }   
13  function printPrieview() {      
14  document.all.WebBrowser.ExecWB(7,1);    
15  }    
16 function printImmediately() {      
17 document.all.WebBrowser.ExecWB(6,6);     
18  window.close();    
19  }     
20 </script>
21 <OBJECT  id=WebBrowser  classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 style="display:none">
22 </OBJECT>
23 </noscript>
24 <style media=print>
25 .Noprint{display:none;}  .PageNext{page-break-after: always;}
26 </style>
27 <table align="center" class=NOPRINT>
28   <tr>
29     <td align="center"><BUTTON title=打印 onclick=printWithAlert()>打印</BUTTON>
30       <BUTTON title=直接打印 onclick=printWithoutAlert()>直接打印</BUTTON>
31       <input type=button value="打印设置" onClick="printSetup()" >
32       <button onclick ='printPrieview()' title='打印预览...' >打印预览</button></td>
33   </tr>
34 </table>
35 <div  class=NOPRINT> 以下为打印区:<br>
36 </div>
37 <hr size=1 noshadow color=black  class=NOPRINT >
38 <table class="PageNext" >
39   <tr>
40     <td colspan=2>
41  第一页的内容
42     </td>
43   </tr>
44 </table>
45 <hr size=1 noshadow color=black  class=NOPRINT >
46 <div class="PageNext">
47 第二页内容
48 </div>
49 <hr size=1 noshadow color=black  class=NOPRINT >
50 第三页内容
51 </html>
52

摘自 oO源Oo
补充:web前端 , JavaScript ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,