一个不错的html 打印代码支持翻页

所属分类: 网页制作 / HTML/Xhtml 阅读数: 1930
收藏 0 赞 0 分享
ylbtech_html_print

html打印代码,支持翻页


复制代码
代码如下:

<html>
<head>
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<title>看看</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--media=print 这个属性可以在打印时有效-->
<style media=print>
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
<style>
.tdp
{
border-bottom: 1 solid #000000;
border-left: 1 solid #000000;
border-right: 0 solid #ffffff;
border-top: 0 solid #ffffff;
}
.tabp
{
border-color: #000000 #000000 #000000 #000000;
border-style: solid;
border-top-width: 2px;
border-right-width: 2px;
border-bottom-width: 1px;
border-left-width: 1px;
}
.NOPRINT {
font-family: "宋体";
font-size: 9pt;
}
</style>
</head>
<body >
<center class="Noprint" >
<p>
<OBJECT id=WebBrowser classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 width=0>
</OBJECT>
<input type=button value=打印 onclick=document.all.WebBrowser.ExecWB(6,1)>
<input type=button value=直接打印 onclick=document.all.WebBrowser.ExecWB(6,6)>
<input type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>
</p>
<p> <input type=button value=打印预览 onclick=document.all.WebBrowser.ExecWB(7,1)>
<br/>
</p>
<hr align="center" width="90%" size="1" noshade>
</center>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td colspan="3" class="tdp">第1页</td>
</tr>
<tr>
<td width="29%" class="tdp">&nbsp;</td>
<td width="28%" class="tdp">&nbsp;</td>
<td width="43%" class="tdp">&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="tdp">&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<hr align="center" width="90%" size="1" noshade class="NOPRINT" >
<!--分页-->
<div class="PageNext"></div>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td class="tdp">第2页</td>
</tr>
<tr>
<td class="tdp">看到分页了吧</td>
</tr>
<tr>
<td class="tdp">&nbsp;</td>
</tr>
<tr>
<td class="tdp">&nbsp;</td>
</tr>
<tr>
<td class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<hr align="center" width="90%" size="1" noshade class="NOPRINT" >
<div class="PageNext"></div>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td class="tdp">第3页</td>
</tr>
<tr>
<td class="tdp">看到分页了吧</td>
</tr>
<tr>
<td class="tdp">&nbsp;</td>
</tr>
<tr>
<td class="tdp">&nbsp;</td>
</tr>
<tr>
<td class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
更多精彩内容其他人还在看

超链接的宽度和高度直接设置不起作用的解决方法

这篇文章主要介绍了超链接的宽度和高度直接设置不起作用的解决方法,需要的朋友可以参考下
收藏 0 赞 0 分享

html下拉菜单提交后保留选中值而不返回默认值

这篇文章主要介绍了html下拉菜单提交后如何保留选中值而不返回默认值,方法虽简单,但比较实用,需要的朋友可以参考下
收藏 0 赞 0 分享

html用style添加属性示例

这篇文章主要介绍了html用style添加属性的写法,比较实用,有需要的朋友可以参考下
收藏 0 赞 0 分享

HTML元素设置焦点的方法

HTML元素设置焦点,大都是采用js的focus方法来进行设置,下面有个示例,大家可以参考下
收藏 0 赞 0 分享

html用title属性实现鼠标悬停显示文字

实现鼠标悬停显示文字,html中使用title属性就可实现显示文字的效果,这个属性还是比较实用的,需要的朋友可以参考下
收藏 0 赞 0 分享

html 用超链接打开新窗口其可控制窗口属性

这篇文章主要介绍了html如何用超链接打开新窗口其可控制窗口属性,主要使用到js的window.open方法,感兴趣的朋友可以看看哦
收藏 0 赞 0 分享

html 可输入下拉菜单的实现方法

可输入下拉菜单,不可思议是不是, 本例通过一些方法实现这个不可能的事情,感兴趣的朋友可以参考下
收藏 0 赞 0 分享

a标签href属性与onclick事件使用实例

a标签主要用来实现页面跳转,可以通过href属性实现,也可以在onclick事件里实现,下面为大家简要介绍下其具体的使用
收藏 0 赞 0 分享

HTML cellpadding与cellspacing属性图文详解

这篇文章主要介绍了HTML cellpadding与cellspacing属性,有个演示图,相信大家看过之后就知道了,需要的朋友可以参考下
收藏 0 赞 0 分享

input输入框中的光标大小显示不一致的解决方法

chrome浏览器对光标高度的设置原则为,当没有内容的时候光标的高度=input的line-height的值,当有内容时,光标从input的顶端到文字的底部
收藏 0 赞 0 分享
查看更多