javascript 打印页面代码
更新时间:2009年03月24日 00:53:16 作者:
不用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>
相关文章
JavaScript在Android的WebView中parseInt函数转换不正确问题解决方法
这篇文章主要介绍了JavaScript在Android的WebView中parseInt函数转换不正确问题解决方法,因转换的字符串数字都以0开头,导致parseInt函数在浏览器和Android WebView中转换结果不一样,本文给出了解决方法,需要的朋友可以参考下2015-04-04
最新评论