<html>
ASP.NET 页面打印与预览
<head>
ASP.NET 页面打印与预览
<title> ASP.NET 打印 - 所见即所得 </title>
ASP.NET 页面打印与预览
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
ASP.NET 页面打印与预览ASP.NET 页面打印与预览
<script language="javascript">ASP.NET 页面打印与预览
ASP.NET 页面打印与预览
function preview()
ASP.NET 页面打印与预览ASP.NET 页面打印与预览
ASP.NET 页面打印与预览{
ASP.NET 页面打印与预览 bdhtml
=window.document.body.innerHTML;
ASP.NET 页面打印与预览 sprnstr
="<!--startprint-->";
ASP.NET 页面打印与预览 eprnstr
="<!--endprint-->";
ASP.NET 页面打印与预览 prnhtml
=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
ASP.NET 页面打印与预览 prnhtml
=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
ASP.NET 页面打印与预览 window.document.body.innerHTML
=prnhtml;
ASP.NET 页面打印与预览 window.print();
ASP.NET 页面打印与预览
//prnform.htext.value=prnhtml;
ASP.NET 页面打印与预览
//prnform.submit();
ASP.NET 页面打印与预览
//alert(prnhtml);
ASP.NET 页面打印与预览
}

ASP.NET 页面打印与预览
</script>
ASP.NET 页面打印与预览
</head>
ASP.NET 页面打印与预览
<body bgcolor="#FFFFFF" text="#000000">
ASP.NET 页面打印与预览辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣
ASP.NET 页面打印与预览
<center>本部分以上不被打印</center>
ASP.NET 页面打印与预览
<!--startprint-->
ASP.NET 页面打印与预览
<table width="84%" align="center" bgcolor="#0000FF" cellpadding="2" cellspacing="1">
ASP.NET 页面打印与预览  
<tr bgcolor="#6699FF">
ASP.NET 页面打印与预览    
<td>
ASP.NET 页面打印与预览      
<div align="center">标题一</div>
ASP.NET 页面打印与预览    
</td>
ASP.NET 页面打印与预览    
<td>
ASP.NET 页面打印与预览      
<div align="center">标题二</div>
ASP.NET 页面打印与预览    
</td>
ASP.NET 页面打印与预览    
<td>
ASP.NET 页面打印与预览      
<div align="center">标题三</div>
ASP.NET 页面打印与预览    
</td>
ASP.NET 页面打印与预览    
<td>
ASP.NET 页面打印与预览      
<div align="center">标题四</div>
ASP.NET 页面打印与预览    
</td>
ASP.NET 页面打印与预览    
<td>
ASP.NET 页面打印与预览      
<div align="center">标题五</div>
ASP.NET 页面打印与预览    
</td>
ASP.NET 页面打印与预览  
</tr>
ASP.NET 页面打印与预览  
<tr bgcolor="#6699FF">
ASP.NET 页面打印与预览    
<td> </td>
ASP.NET 页面打印与预览    
<td> </td>
ASP.NET 页面打印与预览    
<td> </td>
ASP.NET 页面打印与预览    
<td> </td>
ASP.NET 页面打印与预览    
<td> </td>
ASP.NET 页面打印与预览  
</tr>
ASP.NET 页面打印与预览
</table>
ASP.NET 页面打印与预览
<!--endprint-->
ASP.NET 页面打印与预览
<center>本部分以下不被打印</center>
ASP.NET 页面打印与预览辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣辣
ASP.NET 页面打印与预览
<div align="center">
ASP.NET 页面打印与预览  
<input type="button" name="print" value="预览并打印" onclick="preview()">
ASP.NET 页面打印与预览
</div>
ASP.NET 页面打印与预览ASP.NET 页面打印与预览
<style>ASP.NET 页面打印与预览
ASP.NET 页面打印与预览ASP.NET 页面打印与预览@media print
{ASP.NET 页面打印与预览}{
ASP.NET 页面打印与预览    .Noprn {display
:none;}

ASP.NET 页面打印与预览}
ASP.NET 页面打印与预览
</style>
ASP.NET 页面打印与预览
<p class="Noprn">不打印</p>
ASP.NET 页面打印与预览
<table id=datagrid><tr><td>打印</td></tr></table>
ASP.NET 页面打印与预览
<input class=Noprn type=button onclick="window.print()" value="print">
ASP.NET 页面打印与预览
</body>
ASP.NET 页面打印与预览
</html>

相关文章: