<style>
@media print{
.noprint {display:none}
table{
border:1px solid #000000;
}
tr{
background-color:#ffffff;
}
}
</style>
通过css设置不希望打印的className(注意下面的table的className为noprint)<table id="toolbar" cellpadding="0" cellspacing="0" align="center" width="96%" class="noprint">
<tr>
<td width="100%" height="30" valign="middle">
<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=this.document.all.WebBrowser.ExecWB(7,1)>
<input type=button value=导入到excel onclick="javascript:exportExcel();">
<input type="button" value="退出" onclick="javascript:window.close();">
</td>
</tr>
</table>
下面写入需要打印的内容
<table>等等
@media print{
.noprint {display:none}
table{
border:1px solid #000000;
}
tr{
background-color:#ffffff;
}
}
</style>
通过css设置不希望打印的className(注意下面的table的className为noprint)<table id="toolbar" cellpadding="0" cellspacing="0" align="center" width="96%" class="noprint">
<tr>
<td width="100%" height="30" valign="middle">
<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=this.document.all.WebBrowser.ExecWB(7,1)>
<input type=button value=导入到excel onclick="javascript:exportExcel();">
<input type="button" value="退出" onclick="javascript:window.close();">
</td>
</tr>
</table>
下面写入需要打印的内容
<table>等等
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货