http://www.cnblogs.com/moonvan/archive/2010/08/25/1807994.htmljavascript
調用IE自帶的打印功能時,在須要分頁的地方插入以下HTML,即可實現打印分頁:html
<div style="page-break-before:always;"><br /></div>java
http://blog.csdn.net/itchiang/article/details/9319075post
http://www.jb51.net/article/48506.htmui
<!DOCTYPE html>
<
html
>
<
head
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/>
<
title
>無標題文檔</
title
>
<
script
type
=
"text/javascript"
>
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr="
<!--startprint-->
";
eprnstr="
<!--endprint-->
";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
</
script
>
</
head
>
<
body
>
<
p
>1</
p
>
<
p
>2</
p
>
<!--startprint-->
<!--注意要加上html裏star和end的這兩個標記,以前沒加,一直沒效果,誰叫我們菜呢~-->
<
h1
>打印標題</
h1
>
<
p
>打印內容~~</
p
>
<!--endprint-->
<
button
type
=
"button"
onclick
=
"doPrint()"
>打印</
button
>
<
p
>1</
p
>
<
p
>2</
p
>
</
body
>
</
html
>