现在的位置: 首页 > 综合 > 正文

WEB区域打印

2012年11月25日 ⁄ 综合 ⁄ 共 581字 ⁄ 字号 评论关闭
区域打印:

<html>
<head>打印

<scrīpt language="javascrīpt">
function print()
{
    document.body.innerHTML=document.getElementById('print').innerHTML;

    window.print();
}
</scrīpt>

</head>
<body>

<form id="form1" runat="server">
<div id="print">
<table><tr><td></td></tr></table>
</div>

<asp:Button ID="butPrint" runat="server" Text="打印" OnClientClick="Print();" CssClass="cmd_print" />
</form>
</body>
</html>

 

使用CSS区域打印:

定义一个.noprint的class,将不打印的内容放入这个class内。

<style media=print type="text/css">   
.noprint{visibility:hidden}   
</style>   

<p class="noprint">将不打印的代码放在这里。</p>
<a href="javascrīpt:window.print()"打印</a>

 

抱歉!评论已关闭.