jsp中实现打印功能
2013-02-25 18:35
471 查看
1.JavaScript打印
<input id="btnPrint" type="button" value="button"
onclick="javascript:window.print();" style="color:#00f;
font-weight:bold; text-decoration:none;cursor:pointer!important;
cursor:hand"/>
可以用样式控制,你想让那块打印就打印,样式如下:
<style type="text/css"
media=print>
.noprint{display : none }
</style>
然后使用样式就可以:
<p
class="noprint">不需要打印的地方</p>
如果要打印网页中的某一部分,只要把这一部分标记为
<!--startprint--><!---endprint-->中就可以了
=============================================================
2.IE打印
<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)">
<input type="button" value="打印预览"
onclick="document.all.WebBrowser.ExecWB(7,1)">
关于这个组件还有其他的用法,列举如下:
WebBrowser.ExecWB(1,1) 打开
Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
Web.ExecWB(4,1) 保存网页
Web.ExecWB(6,1) 打印
Web.ExecWB(7,1) 打印预览
Web.ExecWB(8,1) 打印页面设置
Web.ExecWB(10,1) 查看页面属性
Web.ExecWB(15,1) 好像是撤销,有待确认
Web.ExecWB(17,1) 全选
Web.ExecWB(22,1) 刷新
Web.ExecWB(45,1) 关闭窗体无提示
<input id="btnPrint" type="button" value="button"
onclick="javascript:window.print();" style="color:#00f;
font-weight:bold; text-decoration:none;cursor:pointer!important;
cursor:hand"/>
可以用样式控制,你想让那块打印就打印,样式如下:
<style type="text/css"
media=print>
.noprint{display : none }
</style>
然后使用样式就可以:
<p
class="noprint">不需要打印的地方</p>
如果要打印网页中的某一部分,只要把这一部分标记为
<!--startprint--><!---endprint-->中就可以了
=============================================================
2.IE打印
<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)">
<input type="button" value="打印预览"
onclick="document.all.WebBrowser.ExecWB(7,1)">
关于这个组件还有其他的用法,列举如下:
WebBrowser.ExecWB(1,1) 打开
Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
Web.ExecWB(4,1) 保存网页
Web.ExecWB(6,1) 打印
Web.ExecWB(7,1) 打印预览
Web.ExecWB(8,1) 打印页面设置
Web.ExecWB(10,1) 查看页面属性
Web.ExecWB(15,1) 好像是撤销,有待确认
Web.ExecWB(17,1) 全选
Web.ExecWB(22,1) 刷新
Web.ExecWB(45,1) 关闭窗体无提示
相关文章推荐
- jsp页面实现打印功能
- 巧用jsp页面用表单实现动态打印功能
- JSP实现打印功能
- jsp 页面实现局部打印功能与全局打印
- Java JSP实现页面打印的功能
- jsp调用IE打印控件实现打印功能,并且实现分页功能
- jsp如何实现报表打印功能?简单点,不要太复杂的。在此先谢谢各位大虾。。。
- C# 实现打印功能
- 在web页面中打印功能的实现问题集锦
- jsp+servlet 实现登录功能
- web页面实现指定区域打印功能
- jsp实现登录功能并且将数据传到数据库
- 在Web中如何运用JavaScript实现打印功能
- jsp实现针对excel及word文档的打印方法
- MVC-结合Servlet和JSP实现分页功能
- JSP+JQuery Ajax+Servlet 实现轮询方式消息提示功能
- java-第二章-升级我行我素购物管理系统,实现打印小票和计算积分功能.
- JSP实现从mysql读取数据并实现分页功能
- jsp中js实现本地图片预览基本功能
- jsp页面通过ajax向后台传参实现收藏功能