zoukankan
html css js c++ java
ASP.NET 页面打印与预览
<
html
>
<
head
>
<
title
>
ASP.NET 打印 - 所见即所得
</
title
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=gb2312"
>
<
script
language
="javascript"
>
function
preview()
{
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();
//
prnform.htext.value=prnhtml;
//
prnform.submit();
//
alert(prnhtml);
}
</
script
>
</
head
>
<
body
bgcolor
="#FFFFFF"
text
="#000000"
>
辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣
<
center
>
本部分以上不被打印
</
center
>
<!--
startprint
-->
<
table
width
="84%"
align
="center"
bgcolor
="#0000FF"
cellpadding
="2"
cellspacing
="1"
>
<
tr
bgcolor
="#6699FF"
>
<
td
>
<
div
align
="center"
>
标题一
</
div
>
</
td
>
<
td
>
<
div
align
="center"
>
标题二
</
div
>
</
td
>
<
td
>
<
div
align
="center"
>
标题三
</
div
>
</
td
>
<
td
>
<
div
align
="center"
>
标题四
</
div
>
</
td
>
<
td
>
<
div
align
="center"
>
标题五
</
div
>
</
td
>
</
tr
>
<
tr
bgcolor
="#6699FF"
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
<
td
>
</
td
>
</
tr
>
</
table
>
<!--
endprint
-->
<
center
>
本部分以下不被打印
</
center
>
辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣
<
div
align
="center"
>
<
input
type
="button"
name
="print"
value
="预览并打印"
onclick
="preview()"
>
</
div
>
<
style
>
@media print
{
}
{
.Noprn {display
:
none
;
}
}
</
style
>
<
p
class
="Noprn"
>
不打印
</
p
>
<
table
id
=datagrid
><
tr
><
td
>
打印
</
td
></
tr
></
table
>
<
input
class
=Noprn
type
=button
onclick
="window.print()"
value
="print"
>
</
body
>
</
html
>
查看全文
相关阅读:
基于mybatis的crud demo
事务的隔离级别
spring中ioc的实现
spring中xml配置文件
spring中AOP的实现
mybatis框架
基于Mapreduce的并行Dijkstra算法执行过程分析
算法技巧:位运算 逻辑运算
day04_09 while循环03
day04_08 while循环02
原文地址:https://www.cnblogs.com/zzxap/p/2175964.html
最新文章
团队冲刺——第三天
团队冲刺——第二天
第八周学习进度总结
团队冲刺——第一天
《代码大全(第二版)》阅读笔记02
第七周学习进度总结
《代码大全(第二版)》阅读笔记01
团队项目-NABCD项目分析
第六周学习进度总结
第一行代码阅读笔记1
热门文章
第十三周总结
第十二周总结
单词统计
顶会热词统计
梦断代码阅读笔记3
梦断代码阅读笔记2
第十一周总结
水滴记账用户场景
第十周总结
mybatis 多表查询 之一对一
Copyright © 2011-2022 走看看