<TR>
<TD align="center" colspan=2 width=560><IMG id="Img1" style="CURSOR: hand" onclick="Print()" src="file:///D:\mywork\StuITC\Common\Images\printView.JPG"
border="0">&nbsp;</TD>
</TR>
                 //打印
function Print()
{
document.all.Img1.style.display="none";
window.print();
window.close();
}

解决方案 »

  1.   

    <%@ Page Language="C#"  Inherits="Nrc.Lqs.Show"  ContentType="text/html" ResponseEncoding="gb2312" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>信息显示页面</title>
    <!--media=print 这个属性可以在打印时有效-->
    <style media=print>
    .Noprint{display:none;}
    .PageNext{page-break-after: always;}
    </style><style>
    .tdp
    {
        border-bottom: 1 solid #000000;
        border-left:  1 solid #000000;
        border-right:  0 solid #ffffff;
        border-top: 0 solid #ffffff;
    }
    .tabp
    {
        border-color: #000000 #000000 #000000 #000000;
        border-style: solid;
        border-top-width: 2px;
        border-right-width: 2px;
        border-bottom-width: 1px;
        border-left-width: 1px;
    }
    .NOPRINT {
    font-family: "宋体";
    font-size: 9pt;
    }
    <style type="text/css">
    <!--
    @import url("../css/css.css");
    .style1 {color: #FF0000}
    -->
    </style>
    <SCRIPT LANGUAGE=javascript>
    <!--
    function setPrint()
    {
    WB.ExecWB(8,1);
    }
    function previewPrint()
    {
    WB.ExecWB(7,1)
    }
    function Print()
    {
    WB.ExecWB(6,1)
    }
    function DirectPrint()
    {
    WB.ExecWB(6,6)
    }
    function ShowPrint()
        {
    var str;
    str="<INPUT type='button' value='页面设置' id=button1 name=button1 onclick='setPrint();'>";
    str=str+"<INPUT type='button' value='打印预览' id=button2 name=button2 onclick='previewPrint();'>";
        str=str+"<input  type='button'  value=' 打  印 ' onclick='Print();'>";
    str=str+"<input  type='button'  value='直接打印'  onclick='DirectPrint();'>";
    str=str+"<input  type='button'  value='隐藏打印选项'  onclick='HidePrint()'>";
    document.all.item("Print").innerHTML =str;
    }
    function HidePrint()
        {
    document.all.item("Print").innerHTML="";
    }
    //-->
    </SCRIPT>
    <style type="text/css">
    <!--
    body {
    margin-left: 0px;
    margin-top: 0px;
    }
    -->
    </style>
    <link href="../skins/2004/main.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0>
    </OBJECT>
    <form runat="server">
    <table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="F1F9FE">
      <tr>
        <td height="6" colspan="2" scope="col"></td>
      </tr>
      <tr>
        <td height="11" colspan="2" scope="col" ><br>
          <div align="center" >
              <%Response.Write("<font color='ff0000' class='showtitle'>"+Title+"</font>");%>
            &nbsp;<br><br>

        </div></td></tr>
      <tr>
        <td width="368" height="6" class="12black" scope="col" ><div align="left">
              <%Response.Write("<font color='ff0000' >&nbsp;发布人:"+CreateMan+"&nbsp;&nbsp;</font>");%>
        </div>
    </td>
        <td width="412" height="6" class="12black" scope="col" ><div align="right">
              <%Response.Write("<font color='ff0000' >发布日期:"+PrintDate+"&nbsp;&nbsp;</font>");%>
        </div></td>
      </tr>
      <tr>
        <td height="6" colspan="2" class="12black" scope="col" ><hr align="right" size=1 color="#990000"></td>
      </tr>
      <tr>
        <td height="30" colspan="2" scope="row"><div align="left">
        <table border="0" align="center">
          <tr>
            <td width="759"><%Response.Write(Content);%></td>
          </tr>
        </table>
        </div></td>
        </tr>
      <tr>
        <td colspan="2" class="12black" scope="row"><br>
    <HR SIZE=1 color="#990000">
    <div align="right">
              <%Response.Write("<font color='ff0000' >发布部门:"+CreateDept+"&nbsp;&nbsp;</font>");%>
        </div><br>   <div id="hiden" class="NOPRINT" align="center">    <asp:Button ID="btnAccept"   oncommand="Button_Click" CommandName="ShowSign"   Text="查看签收" runat="server" />
       &nbsp;  
      <asp:Button ID="btnClose"   oncommand="Button_Click" CommandName="Close"   Text="关闭窗口" runat="server" /> 
      <asp:Button ID="btnSign"   oncommand="Button_Click" CommandName="Sign"   Text=" 签  收 " runat="server" />  
        &nbsp;  <asp:Button ID="btnCheck"   oncommand="Button_Click" CommandName="Check"   Text=" 通过审核 " runat="server" /> 
        <asp:Button ID="btnNoCheck"   oncommand="Button_Click" CommandName="NoCheck"   Text=" 不通过审核(删除) " runat="server" /> 
        <input type="button" name="Submit" value="显示打印选项" onClick="ShowPrint()">
      <br>
        <br>
    </div>
       <div  class="NOPRINT" align="center"  id="Print"></div>
    </td>
      </tr>
    </table>
    </form>
    </body>
    </html>这是一个我用来打印的.aspx页面,很好用.
      

  2.   

    javascript里直接写window.print()就可以了,这是调用ie自己的打印功能!
      

  3.   

    http://search.csdn.net/Expert/topic/2395/2395858.xml?temp=.916012
    以前搞的!
    可以实现哪个打印,哪个不打印!