JavaScript分頁列印代碼
來源:互聯網
上載者:User
<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=列印 onclick=printWithAlert()>列印</BUTTON> <BUTTON title=直接列印 onclick=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>