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
>
查看全文
相关阅读:
android---eclipse中绑定第三方源代码
软件安装错误:invalid Drive
android---获取设备相关信息
android---获取cpu核心个数
android---库工程
eclipse---常用快捷键
android---adb常用命令
好用的工具
“您即将提交的信息不安全”问题处理
业务系统pdf样式问题01
原文地址:https://www.cnblogs.com/zzxap/p/2175964.html
最新文章
【转载】Erlang 中 link 和 monitor 的区别
LeetCode-Repeated DNA Sequences (位图算法减少内存)
LeetCode-Sudoku Solver (递归解法)
Longest Substring Without Repeating Characters
erlang-jiffy 安装手记
ejabberd 的框架
ejabberd 在eclipse(erlide)中的配置、调试、运行
MySQL 用户管理——权限表
linux kill -l 信号列表
Mysql的接口函数
热门文章
vs2013编译protobuf
Linux时间函数
unicode 或 utf8 中文编码范围
Socket的错误码和描述
Linux字符串编码转换
MFC操作读取excel文件
istat Menus 序列号
android---am命令
eclipse---android dependenies不显示解决办法
volatile
Copyright © 2011-2022 走看看