关于利用浏览器打印的实现,不需要用ScirptX插件

mac2022-06-30  74

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>证书显示页</title>

  <style media="print">

      .Noprint{

         display:none;

      }

      .PageNext{

         page-break-after:always;

      }

   </style>

</head>

<script language="javascript">   

  function   previewPrint()  

  {  

   WB.ExecWB(7,1); 

  }     

  function printsetup(){ 

  // 打印页面设置 

  document.form1.wb.execwb(8,1); 

 }

 //打印预览

  function printpreview(){ 

   document.form1.wb.execwb(7,1); 

  } 

   //打印

   function printit() 

   { 

      if (confirm('确定打印吗?')) { 

       //document.form1.wb.execwb(6,6);

       document.form1.wb.execwb(6,1);

      } 

   }

   //直接打印

   function printNow()

   {

      if (confirm('确定打印吗?')) { 

       document.form1.wb.execwb(6,6);

       //document.form1.wb.execwb(6,1);

      } 

   }

</script>

<script language="JavaScript">  

 var HKEY_Root,HKEY_Path,HKEY_Key;

 HKEY_Root="HKEY_CURRENT_USER";

 HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";

 //设置网页打印的页眉页脚为空

 function PageSetup_Null()

 {

  try

  {

         var Wsh=new ActiveXObject("WScript.Shell");

  HKEY_Key="header";

  Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");

  HKEY_Key="footer";

  Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");

  }

  catch(e){

  }

 }

 </script>

<body >

   <form runat="server">

      <table style="width:924px">

         <tr>

            <td>

               <center >

                  <input type="button" value="页面设置" />

                  <input type="button" value="打印预览" />

                  <input type="button" value="打印" />

                  <input type="button" value="直接打印" />

               </center>

            </td>

         </tr>

         <tr>

            <td style="height: 650px">

               <table width="100%" border="0" cellpadding="0" cellspacing="0" style="height: 485px">

                  <tr>

                     <td>

                        <table width="450" border="1" align="center" cellpadding="0" cellspacing="0"

                           bordercolor="#333333" style="height: 532px">

                           <tr>

                              <td style="height: 365px">

                                 <table width="98%" height="581" border="0" align="center" cellpadding="0" cellspacing="0">

                                    <tr>

                                       <td height="30">

                                          <div align="center" >

                                             备        注</div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="551" valign="top">

                                          <asp:Label runat="server" Text="Label"></asp:Label></td>

                                    </tr>

                                 </table>

                              </td>

                           </tr>

                        </table>

                     </td>

                     <td>

                        <table width="450" border="1" align="center" cellpadding="0" cellspacing="0"

                           bordercolor="#333333" style="height: 424px">

                           <tr>

                              <td style="height: 345px">

                                 <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="height: 548px">

                                    <tr>

                                       <td height="40">

                                          <div align="center" >

                                             商   洛   供   电   局</div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="54">

                                          <div align="center" >

                                             检 定 证 书</div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="39" valign="top">

                                          <div align="center">

                                             <table height="18" border="0" cellpadding="0" cellspacing="0" style="width: 190px">

                                                <tr>

                                                   <td width="61" height="18" >

                                                      <div align="right" >

                                                         <asp:TextBox runat="server" CssClass="TextBoxLine" ReadOnly="True"

                                                            Width="54px"></asp:TextBox></div>

                                                   </td>

                                                   <td width="47">

                                                      <div align="center" >

                                                         字第</div>

                                                   </td>

                                                   <td width="61" >

                                                      <asp:TextBox runat="server" CssClass="TextBoxLine" ReadOnly="True" Width="54px"></asp:TextBox></td>

                                                   <td width="31" >

                                                      号</td>

                                                </tr>

                                             </table>

                                          </div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="30">

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="30">

                                          <div align="center">

                                              </div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="30">

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="30">

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="30">

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="30">

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="30">

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="45">

                                           </td>

                                    </tr>

                                    <tr>

                                       <td height="45" >

                                          <div align="right">

                                             检定<asp:TextBox runat="server" CssClass="TextBoxLine" ReadOnly="True"

                                                Width="130px"></asp:TextBox>  </div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td style="height: 45px">

                                          <div align="right">

                                             审核<asp:TextBox runat="server" CssClass="TextBoxLine" ReadOnly="True"

                                                Width="130px"></asp:TextBox>  </div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td style="height: 45px">

                                          <div align="right">

                                             主管<span ><asp:TextBox runat="server" CssClass="TextBoxLine"

                                                ReadOnly="True" Width="130px"></asp:TextBox></span>  </div>

                                       </td>

                                    </tr>

                                    <tr>

                                       <td height="45">

                                          <table width="90%" height="20" border="0" align="center" cellpadding="0" cellspacing="0">

                                             <tr>

                                                <td>

                                                   <div align="center">

                                                      检定日期<asp:TextBox runat="server" CssClass="TextBoxLine" ReadOnly="True"

                                                         Width="60px"></asp:TextBox>年<asp:TextBox runat="server" CssClass="TextBoxLine"

                                                            ReadOnly="True" Width="20px"></asp:TextBox>月<span ><asp:TextBox

                                                               runat="server" CssClass="TextBoxLine" ReadOnly="True" Width="20px"></asp:TextBox></span>日   

                                                      检定周期<span ><asp:TextBox runat="server" CssClass="TextBoxLine"

                                                         ReadOnly="True" Width="40px"></asp:TextBox></span>年</div>

                                                </td>

                                             </tr>

                                          </table>

                                       </td>

                                    </tr>

                                 </table>

                              </td>

                           </tr>

                        </table>

                     </td>

                  </tr>

               </table>

            </td>

         </tr>

      </table>

      <object classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=6,1,429,14"

         width="0">

      </object>

      <object width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">

      </object>

   </form>

</body>

</html>

转载于:https://www.cnblogs.com/liyejun/archive/2009/03/25/1421249.html

最新回复(0)