asp 打印页面

来源:互联网 发布:mac做端口映射 编辑:程序博客网 时间:2024/04/30 01:13

 <script   language="javascript">    
    function   printsetup(){    
    //   打印页面设置    
    WB.ExecWB(8,1);    
    }    
    function   printpreview(){    
    //   打印页面预览    
          
    WB.ExecWB(7,1);    
           
          
    }    
   
    function   printit()    
    {    
    if   (confirm(''确定打印吗?''))   {    
    WB.ExecWB(6,6)    
    }    
    }    
  </script>    
   
  <OBJECT   classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"   height=0   id=WB   name=WB   width=0></OBJECT>  
  <form   method="post"   name="myform"   action="">  
  <input   type=button   value="打印页面设置"   onclick="javascript:printpreview();">  
  </form>

 

 

 

 

 

 

 

<?xml   version="1.0"   encoding="gb2312"?>  
  <!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>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312"   />  
  <title>打印设置</title>  
  <link   rel="stylesheet"   type="text/css"   href="../__Css/1/style.css"   />  
  <style   type="text/css">  
  <!--  
  input.fbtborder   {  
  color:   #0000FF;  
  }  
  -->  
  </style>  
  </head>  
  <body   class="bodycolor">  
  <OBJECT     classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"        
  height="0"     id="wb"     name="wb"     width="0"></OBJECT>  
  <script   language="JavaScript1.2">  
  function   alertwin(){  
  alert("浏览器不支持该操作");  
  }  
   
  function     PrintSetup()   {      
  //     打印页面设置      
  try   {  
  wb.execwb(8,1);  
  }  
  catch(e){  
  alertwin();  
  }  
  }    
     
  function     PrintPreview(){      
  //     打印页面预览      
  try   {  
  wb.execwb(7,1);  
  }  
  catch(e){  
  alertwin();  
  }  
  }      
   
  function     PrintTest()      
  {      
  if     (confirm('确定测试打印吗?')){    
  try   {  
  wb.execwb(6,6)  
  }  
  catch(e){  
  alertwin();  
  }  
  }      
  }      
  </script>  
  <h1>打印设置</h1>  
  <ul>  
      <input   name="pset"   type="button"   class="fbtborder"   id="pset"   value="页面设置"   onclick="javascript:PrintSetup();"   />  
      <input   name="ppre"   type="button"   class="fbtborder"   id="ppre"   value="打印预览"   onclick="javascript:PrintPreview();"   />  
      <input   name="ptest"   type="button"   class="fbtborder"   id="ptest"   value="测试打印"   onclick="javascript:PrintTest();"   />  
  </ul>  
   
  </HEAD>  
  <P><strong>更改网页打印时的外观</strong></P>  
   
  <OL>  
      <LI>单击“页面设置”按钮,弹出“页面设置”对话框。   </LI>  
      <LI>在“页边距”框中,键入页边距(以英寸为单位)。   </LI>  
      <LI>在“方向”下面,单击“纵向”或“横向”,指定要纵向还是横向打印页面。   </LI>  
      <LI>在“页眉”和“页脚”框中,使用以下变量指定要打印的信息。变量可以和文本组合(例如:页码,&amp;p/&amp;P)。</LI>  
  </OL>  
   
  <TABLE   WIDTH="100%">  
      <TR   bgcolor="#DEDFDE">    
          <TH>要打印</TH>  
  <TH>键入</TH>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>窗口标题</TD>  
  <TD>&amp;w</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>网页地址   (URL)</TD>  
  <TD>&amp;u</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>短日期格式(由“控制面板”中的“区域设置”指定)</TD>  
  <TD>&amp;d</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>长日期格式(由“控制面板”中的“区域设置”指定)</TD>  
  <TD>&amp;D</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>由“控制面板”中的“区域设置”指定的时间格式</TD>  
  <TD>&amp;t</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>24   小时时间格式</TD>  
  <TD>&amp;T</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>当前页码</TD>  
  <TD>&amp;p</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>总页数</TD>  
  <TD>&amp;P</TD>  
  </TR>  
   
      <TR   bgcolor="#EFEFEF">    
          <TD>文本右对齐(后跟   &amp;b)</TD>  
  <TD>&amp;b</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>文字居中(&amp;b&amp;b   之间)</TD>  
  <TD>&amp;b&amp;b</TD>  
  </TR>  
  <TR   bgcolor="#EFEFEF">    
          <TD>单个   &amp;   号   (&amp;)</TD>  
  <TD>&amp;&amp;</TD>  
  </TR>  
  </TABLE>  
  <p>&nbsp;</p>  
  <P><strong>注意</strong></P>  
  <UL>  
      <LI>1.   IE(Internet   Explorer)浏览器必须为   6.0   或   以上版本,并支持其自带的打印控件。   </LI>  
      <LI>2.   如果希望将页边距的单位设置为毫米(不是英寸),必须在“控制面板”的“区域设置”中更改。   </LI>  
  </UL>  
   
  </body>  
  </html>