JavaScript分页打印代码

<html>
<title>JS 分页批量打印解决方案(只支持IE)</title>
<script language="javascript">         
 function printWithAlert() {       
 document.all.WebBrowser.ExecWB(6,1);    
 }     
 function printWithoutAlert() {      
   document.all.WebBrowser.ExecWB(6,6);     
 }   
 function printSetup() {       
 document.all.WebBrowser.ExecWB(8,1);     
 }    
 function printPrieview() {       
 document.all.WebBrowser.ExecWB(7,1);     
 }     
function printImmediately() {       
document.all.WebBrowser.ExecWB(6,6);      
 window.close();     
 }      
</script>
<OBJECT  id=WebBrowser  classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 style="display:none">
</OBJECT>
</noscript>
<style media=print> 
.Noprint{display:none;}  .PageNext{page-break-after: always;} 
</style>
<table align="center" class=NOPRINT>
  <tr>
    <td align="center"><BUTTON title=打印 οnclick=printWithAlert()>打印</BUTTON>
      <BUTTON title=直接打印 οnclick=printWithoutAlert()>直接打印</BUTTON>
      <input type=button value="打印设置" onClick="printSetup()" >
      <button onclick ='printPrieview()' title='打印预览...' >打印预览</button></td>
  </tr>
</table>
<div  class=NOPRINT> 以下为打印区:<br>
</div>
<hr size=1 noshadow color=black  class=NOPRINT >
<table class="PageNext" >
  <tr>
    <td colspan=2>第一页数据</td>
  </tr>
  <tr>
    <td>用户名</td>
    <td>地址</td>
  </tr>
  <tr>
    <td>张三</td>
    <td>北京</td>
  </tr>
</table>
<hr size=1 noshadow color=black  class=NOPRINT >
<div class="PageNext">第二页数据</div>
<hr size=1 noshadow color=black  class=NOPRINT >
第三页数据
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值