javascript 打印页面代码

复制代码 代码如下:
<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技术javascript 打印页面代码,转载需保留来源!

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。