动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   Asp → 阅读文章

 用asp "Print this Page" 有需要的快来看啊!

作者来源: 
阅读 3229 人次 , 2000-9-4 

东子 于 00-9-3 上午 01:41:46 发表在:ASP地带

用此引用该程序
<A HREF="/ASPScripts/PrintPage.asp?REF=URL_of_Web_Page">
   打印
</A>
PrintPage.asp 原程序
<%@ Language=VBScript %>
<%  Option Explicit   %>
<HTML>
<HEAD>
<TITLE>
4GuysFromRolla.com Article
</TITLE>
</HEAD>
<BODY>
<CENTER>
  <TABLE WIDTH=90% BORDER=2 CELLSPACING=1 BGCOLOR=WHITE>
    <TR><TD ALIGN=CENTER>
      <FONT SIZE=3><I>
        This article was brought to you by 4GuysFromRolla.com!
        When you think ASP, think 4GuysFromRolla.com!<BR>
        http://www.4GuysFromRolla.com
      </FONT></I>
    </TD></TR>
  </TABLE>
</CENTER>
<P>
<%
Const ForReading = 1

Dim strReferrer, objFSO, objOpenFile, strLine
strReferrer = Request.QueryString("REF")

If Len(strReferrer) < 1 then
    strReferrer = Request.ServerVariables("HTTP_REFERER")
    
    If Len(strReferrer) < 1 then
      Response.Write "Egad!  An Error occurred!  We could not" & _
        " determine what page you wanted to view the source for..."
      Response.End
    Else
      'With the HTTP_REFERER, the entire URL is passed along... we
      'need to hack out the http://www.4guysfromrolla.com part
      strReferrer = Right(strReferrer,len(strReferrer)-7)
      strReferrer = Right(strReferrer,len(strReferrer) - _
                          instr(1,strReferrer,"/")+1)
    End If
    
  End If

  'Make sure the user isn't trying to view ASP source
  If InStr(1,UCase(strReferrer),"/WEBTECH/") = 0 OR _
       InStr(1,strReferrer,"..") <> 0 then
    'Shame on you, trying to view a page you're not suppose to...
    Response.Write "Only pages in the /webtech/" & _
               " directory may be viewed in printer-friendly format..."
    Response.End
  End If
   
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
  Set objOpenFile = objFSO.OpenTextFile(Server.MapPath(strReferrer), _
                                                     ForReading)
   
  'There is a line in each article,
  ' <% strPageTitle = "Article Name to display in TITLE Tag" %>
  'There's no need to spit this out...
  Do Until objOpenFile.AtEndOfStream
    strLine = objOpenFile.ReadLine
    If InStr(1, strLine, "<% strPageTitle = ") = 0 then
      Response.Write  strLine & vbCrLf
    End If
  Loop
  
  objOpenFile.Close
  Set objOpenFile = Nothing
  Set objFSO = Nothing
%>
<P><HR><P><CENTER><FONT SIZE=2><I>
This article was brought to you by 4GuysFromRolla.com!  When you think ASP,
think 4GuysFromRolla.com!<BR>
http://www.4GuysFromRolla.com</FONT></I></CENTER><P>
</BODY>
</HTML>
好好享用!  
 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:用asp显示当前在线用户信息,不是简单只显示人数那种![1]
· 下一篇:判断客户端是否支持cookie的脚本!
· asp+的几个特点(二)
· 动感首页更新实现之五 ------ 首页管理篇
· ASP内建对象Response
· ASP 3.0高级编程(十二)
· ASP下使用md5加密注册信息


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077