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 <p  class=NOPRINT> 以下為打印區:<br>
36 </p>
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 <p class="PageNext">
47 第二頁內容
48 </p>
49 <hr size=1 noshadow color=black  class=NOPRINT >
50 第三頁內容
51 </html>
52

摘自 oO源Oo

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *