คัดลอกรหัสรหัสดังนี้:
<%@page language = "java" contentType = "ข้อความ/html; charset = utf-8"
pageencoding = "utf-8"%>
<!
<html>
<head>
<title> JavaScript Print-Print Page Preview Preview Code </title>
<meta http-equiv = content-type content = "text /html; charset = gb2312" />
<สไตล์สื่อ = พิมพ์>
.noprint {display: none;}
.pagenext {หน้า-เบรค-หลังจาก: เสมอ;}
</style>
<ภาษาสคริปต์ = JavaScript>
Fuinction Propsetup () {
// การตั้งค่าหน้าพิมพ์
wb.execwb (8,1);
-
Fuinction Propreview () {{)
// PRINT PAGE PREVIEVER
wb.execwb (7,1);
-
ฟังก์ชั่น printit ()
-
ถ้า (ยืนยัน ('คุณพิมพ์หรือไม่') {
wb.execwb (6,6)
-
-
</script>
</head>
<body>
<div align = center>
<Object ID = ความสูง wb = 0 width = 0
ClassID = CLSID: 8856F961-340A-11D0-A96B-004FD705A2 NAME = WB> </การคัดค้าน>
<อินพุต OnClight = JavaScript: printIt () type = button value = print name = button_print />
<อินพุต onclight = JavaScript: printsetup ();
<อินพุต OnClight = JavaScript: PrintPreview ();
</div>
111 </br>
111 </br>
111 </br>
<div> </div>
222 </br>
222 </br>
222 </br>
<div> </div>
333 </br>
333 </br>
333 </br>
<div> </div>
444 </br>
444 </br>
444 </br>
<div> </div>
555 </br>
555 </br>
555 </br>
</body>
</html>
คัดลอกรหัสรหัสดังนี้:
<html>
<title> JS Paging Batch Printing Solution (รองรับ IE เท่านั้น) </title>
<ภาษาสคริปต์ = "JavaScript">
ฟังก์ชั่น printwithalert () {
document.all.webbrowser.execwb (6,1);
-
ฟังก์ชั่น printwithoutorert () {
document.all.webbrowser.execwb (6,6);
-
Fuinction Propsetup () {
document.all.webbrowser.execwb (8,1);
-
ฟังก์ชั่น propprieviewiew () {
document.all.webbrowser.execwb (7,1);
-
ฟังก์ชั่น printimdiaately () {
document.all.webbrowser.execwb (6,6);
window.close ();
-
</script>
<Object ID = WebBrowser classID = CLSID: 8856F961-340A-11D0-A96B-004FD705A2 Style = "Display: None">>
</ject>
</noscript>
<สไตล์สื่อ = พิมพ์>
.noprint {display: none;} .pagenext {page-break-act: เสมอ;}
</style>
<table allign = "center" class = notrint>
<tr>
<td align = "center"> <button title = print onclick = printwithalert ()> พิมพ์ </putions>
<button title = พิมพ์ onclick โดยตรง = printwithoutorert ()> พิมพ์โดยตรง </button>
<อินพุตประเภท = button value = "การตั้งค่าพิมพ์" onClick = "printsetup ()">
<ปุ่ม onclick = 'printprieviewiew ()' title = 'Print Preview ... '> Print Preview </button> </td>
</tr>
</table>
<div class = notrint> ด้านล่างเป็นพื้นที่พิมพ์: <br>
</div>
<hr size = 1 noshadow color = black class = noprint>
<table>
<tr>
<td colorpan = 2>
เนื้อหาของหน้าแรก
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111117 11111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111-111111111 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
</td>
</tr>
</table>
<hr size = 1 noshadow color = black class = noprint>
<div>
เนื้อหาหน้าสอง
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111117 11111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111-111111111 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
</div>
<hr size = 1 noshadow color = black class = noprint>
เนื้อหาหน้าสาม
</html>