<STYLE>
@media print {
.print { display:block;}
.nprint { display:none;}
}
</STYLE>
<TABLE border=1 class="print">
<TR><TD>打印</TD></TR>
<TR><TD>打印</TD></TR>
<TR><TD>打印</TD></TR>
<TR><TD>打印</TD></TR>
<TR><TD>打印</TD></TR>
</TABLE>
<TABLE border=1 class="nprint">
<TR><TD>不打印,但可见</TD></TR>
<TR><TD>不打印,但可见</TD></TR>
<TR><TD>不打印,但可见</TD></TR>
<TR><TD>不打印,但可见</TD></TR>
<TR><TD>不打印,但可见</TD></TR>
</TABLE>

解决方案 »

  1.   

    <style media="print">
    .nprint  { display: none }
    </style>
      

  2.   

    <style media="print">
    .nprint  { display: none }
    </style>
      

  3.   

    <STYLE>
    @media print {
    .print { display:block;}
    .nprint { display:none;}
    }
    </STYLE>
    <TABLE border=1 class="nprint" id="p1">
    <TR><TD>打印</TD></TR>
    <TR><TD>打印</TD></TR>
    <TR><TD>打印</TD></TR>
    <TR><TD>打印</TD></TR>
    <TR><TD>打印</TD></TR>
    </TABLE>
    <button onclick="checkprint(1)">打印</button>
    <TABLE border=1 class="nprint" id="p2">
    <TR><TD>不打印,但可见</TD></TR>
    <TR><TD>不打印,但可见</TD></TR>
    <TR><TD>不打印,但可见</TD></TR>
    <TR><TD>不打印,但可见</TD></TR>
    <TR><TD>不打印,但可见</TD></TR>
    </TABLE><button onclick="checkprint(1)">打印</button>
    <script>
    function checkprint(id)
    {
    var tempobj=eval("document.all.p"+ID)
    if (tempobj)
    {
    //修改样式表
    tempobj.Classname="print"//这里的Classname有大小写的如果无效可能是大小写出了问题我现在在网吧里,手上没有对应的资料,你再查一下应该可以找到的
    //这里放入你的打印过程
    //把样式表改回来
    tempobj.Classname="nprint"
    }
    }
    </script>
      

  4.   

    不好意思第二个button应该是<button onclick="checkprint(2)">打印</button>