当前位置: 首页 > 图文教程 > 网络编程 > Javascript > javascript 打印页面代码

Javascript
JavaScript 渐变效果页面图片控制
JavaScript blog式日历控件新算法
Javascript 读后台cookie代码
js 弹簧效果代码
JavaScript滑移效果代码
javascript字符串拆分成单个字符相加和不超过10,求最终值
Prototype中dom对象方法汇总
Jquery与Prototype混合用法对比
javascript下IE与FF兼容函数收集
突破winxp sp2/win2003 sp2超强弹窗代码
js点击出现场层层外点击层消失的代码
Javascript模拟scroll滚动效果脚本
javascript各种复制代码收集
javascript的trim,ltrim,rtrim自定义函数
仿3721首页模块拖曳移动效果js代码[可拖曳层移动层]
Javascript拖拽系列文章1之offsetParent属性
Discuz! 6.1_jQuery兼容问题
js日历控件(可精确到分钟)
javascript DOM实用学习资料
javascript实现的树型下拉框改进版

Javascript 中的 javascript 打印页面代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 236 ::
收藏到网摘: n/a

不用window.print实现的打印效果代码。
复制代码 代码如下:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>javascript打印页面</title>
<script type="text/javascript"><!--
function fPrint(){
//隐藏不需要打印的内容.
document.getElementById("divOperate").style.display="none";
document.all.WebBrowser.ExecWB(7,1);
document.getElementById("divOperate").style.display="block";
}
// --></script>
</head>
<body>
<div id="divOperate">
<a href="javascript:void(0);" href="javascript:void(0);" onclick="fPrint();">打印</a>
<object id="WebBrowser" width="10" height="10" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
</div>
<div id="divPrint">
<div>设置标题</div>
<table border="1">
<tr>
<td>这里是要打印的内容</td>
<td>hello</td>
<td>hello</td>
</tr>
<tr>
<td>hello</td>
<td>hello</td>
<td>hello</td>
</tr>
</table>
</div>
</body>
</html>