<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Test</title>
<style>
@media print{
.noprint{display:none;}
}
</style>
</head><body>
<span class=noprint >不打印class="noprint"的对象</span>
<table border="1" width="100%" >
<tr>
<td width="50%">fdsafdsf</td>
<td width="50%">afdsa</td>
</tr>
<tr>
<td width="50%">dsaf</td>
<td width="50%">dsaf</td>
</tr>
</table>
</body></html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Test</title>
<style>
@media print{
.noprint{display:none;}
}
</style>
</head><body>
<span class=noprint >不打印class="noprint"的对象</span>
<table border="1" width="100%" >
<tr>
<td width="50%">fdsafdsf</td>
<td width="50%">afdsa</td>
</tr>
<tr>
<td width="50%">dsaf</td>
<td width="50%">dsaf</td>
</tr>
</table>
</body></html>
<HTML>
<HEAD>
<title>WebForm1</title> <script language="javascript">
function preview()
{
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
</script>
</HEAD>
<body>
<form id="WebForm1" method="post">
<center>本部分以上不被打印</center>
<!--startprint-->
<div align="center">
<table border="1" width="100%" >
<tr>
<td width="50%">fdsafdsf</td>
<td width="50%">afdsa</td>
</tr>
<tr>
<td width="50%">dsaf</td>
<td width="50%">dsaf</td>
</tr>
</table>
</div>
<!--endprint-->
<center>本部分以下不被打印</center>
<div align="center">
<input type="button" name="print" value="预览并打印" onclick="preview()">
</div> </form>
</body>
</HTML>
<HTML>
<HEAD>
<title>WebForm1</title><script language="javascript">
function preview()
{
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
</script>
</HEAD>
<body>
<form id="WebForm1" method="post">
<center>本部分以上不被打印</center>
<!--startprint-->
<div align="center">
<table border="1" width="100%" >
<tr>
<td width="50%">fdsafdsf</td>
<td width="50%">afdsa</td>
</tr>
<tr>
<td width="50%">dsaf</td>
<td width="50%">dsaf</td>
</tr>
</table>
</div>
<!--endprint-->
<center>本部分以下不被打印</center>
<div align="center">
<input type="button" name="print" value="预览并打印" onclick="preview()">
</div></form>
</body>
</HTML>