js打印WEB页面内容代码大全
http://www.cnblogs.com/moonvan/archive/2010/08/25/1807994.html
js控制分页打印、打印分页示例
调用IE自带的打印功能时,在需要分页的地方插入如下HTML,便可实现打印分页:
<div style="page-break-before:always;"><br /></div>
http://blog.csdn.net/itchiang/article/details/9319075
http://www.jb51.net/article/48506.htm
<!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
>