- 论坛徽章:
- 0
|
我是用css控制,直接打印的,在ie和ff下效果都不错。
css:
<style type="text/css">
<!--
td, p, li, div
{
font: 14px tahoma;
}
.smallfont
{
font-size: 12px;
}
.tborder
{
border: 1px solid #000000;
}
.tborderbottom
{
border-bottom: 1px solid #000000;
border-left: 0px solid #ffffff;
border-right: 0px solid #ffffff;
border-top: 0px solid #ffffff;
}
.tborderleftbottom
{
border-bottom: 1px solid #000000;
border-left: 1px solid #000000;
border-right: 0px solid #ffffff;
border-top: 0px solid #ffffff;
}
.tborderrighttop
{
border-bottom: 0px solid #ffffff;
border-left: 0px solid #ffffff;
border-right: 1px solid #000000;
border-top: 1px solid #000000;
}
.thead
{
background-color: #EEEEEE;
}
.page
{
background-color: #FFFFFF;
color: #000000;
}
-->
</style>
<style media=print>
.noprint
{
display:none;
}
.pagenext
{
page-break-after: always;
}
</style>
<script language="javascript" type="text/javascript">
<!--
function printweb()
{
this.focus();
window.print();
}
// -->
</script>
html:
<div align="right" class="noprint">
<input type=button tabindex="1" accesskey="p" onclick="javascript:printweb(this);" value=" 打印 ">
<input type=button tabindex="2" accesskey="b" onclick="history.back(1);" value=" 返回 ">
</div>
这样里面的文字是不会打印出来的。
一个简单的table:
<table class="tborderrighttop" cellpadding="6" cellspacing="0" border="0" width="100%">
<tr>
<td class="tborderleftbottom" colspan="5">用户报表</td>
</tr>
<tr>
<td class="tborderleftbottom" nowrap="nowrap">日期</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">07-24</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">07-25</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">07-26</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">07-27</td>
</tr>
<tr>
<td class="tborderleftbottom" nowrap="nowrap">新增</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">0</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">0</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">0</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">0</td>
</tr>
<tr>
<td class="tborderleftbottom" nowrap="nowrap">总数</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">354</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">354</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">354</td>
<td class="tborderleftbottom" nowrap="nowrap" align="right">354</td>
</tr>
</table> |
|