⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search2.asp

📁 电脑技术精华大全-共77册-507M.zip
💻 ASP
字号:
<%
Head = "本 站 搜 索 引 擎"
SearchString = Request("SearchString")

dim thePos, content

Function UnMapPath(Path)  '将 Web 服务器的真实路径还原成虚拟目录中的 URL 
  UnMapPath = Replace(Mid(Path, Len(Server.MapPath("/")) + 1), "\", "/")
End Function

Function SearchFile(f, s, title)  '返回逻辑值
  Set fopen = fs.OpenTextFile(f)  '打开 html 文本文件
  content = fopen.ReadAll         '读取所有内容,用 content 变量保存
  fopen.Close

  thePos = InStr(1,content,S,vbTextCompare)  '欲搜索的字符串在 html 文件中的位置
  SearchFile = thePos>0  '把逻辑表达式的值赋给 SearchFile
  If SearchFile Then
    pos1 = InStr(1, content, "<TITLE>", vbTextCompare)
    pos2 = InStr(1, content, "</TITLE>", vbTextCompare)
    title = ""
    If pos1>0 And pos2>0 Then
     title=Mid(content, pos1 + 7, pos2 - pos1 - 7)
    End If
  End If
End Function

Function FolderLink( fd )
  vPath = UnMapPath( fd.Path )
  FolderLink = "<A HREF=""" &  vPath & """>" & vPath & "</A>"
  FolderLink = "<IMG SRC=folder.gif Align=TextTop> "& FolderLink
End Function

Function FileLink( f, title )
   vPath = UnMapPath( f.Path )
   If title = "" Then title = f.Name
   FileLink = "<A HREF=""" &  vPath & """>" & title & "</A>"
   FileLink = "<UL><IMG SRC=file.gif Align=TextTop> " & FileLink & "   (" & f.Name & ")" & "</UL>"
  ' FileLink = FileLink & "<UL>" & server.htmlencode(Mid(content,thePos-15,15+15+15)) & "</UL>"
End Function

Sub SearchFolder( fd, s )
   found = False  
  '对起始文件夹下的文件:
   For each f In fd.Files
      pos = InStrRev(f.Path, "." )  '取文件/文件夹的扩展名
      If pos > 0 Then
         ext = Mid(f.Path, pos + 1 )
      Else
         ext = ""
      End If
      If LCase(ext) = "htm" or LCase(ext) = "html" Then  '如果是 html 文件
         If SearchFile( f, s, title ) Then  '如果找到目标字符串
            If found = False Then
               found = True
               Response.Write FolderLink(fd) & "<P>"  '输出文件夹链接
            End If
            Response.Write FileLink(f, title)  '输出文件链接
         End If
      End If
   Next

  '对起始文件夹下的文件夹:
   For each sfd In fd.SubFolders  '递归调用开始
      SearchFolder sfd, s
   Next
End Sub
%>
<html>

<head>
<title><%=Head%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb_2312-80">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<style type="text/css">
<!--
body { margin-top: 0px; margin-left: 0px; margin-right:0px;}
A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active{ font: 9pt "宋体"; cursor: hand; color: #FF0033 }
       TD{ FONT-SIZE: 9pt}
-->
</style>
</head>

<body bgcolor="azure">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
  <td width="50">&nbsp;</td>
  <td bgcolor="#e8e8ff">您在本站的位置:
      <a href="../main.htm">主 页</a> &gt;&gt; 本站内容检索
  </td>
  </tr>
</table><br>
<center><font style="color:red;font-family:楷体_gb2312;font-size:15pt"><%=Head%></font>&nbsp;&nbsp;&nbsp;&nbsp;<img src="../image/search_me.gif" border="0" WIDTH="128" HEIGHT=40 alt=" 本站搜索 "></center>
<hr>

<center>
<form action="Search2.asp" method="Get">
 <p>请输入欲搜索的字串:<input type="text" size="20" name="SearchString" value="<%=SearchString%>">
 <input type="submit" value="搜 索"> </p>
</form>
</center>
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set fd = fs.GetFolder( Server.MapPath("..") )

If SearchString <> "" Then
  Response.Write "<H2>搜索 " & SearchString & " 的结果:</H2><P>"
  SearchFolder fd, SearchString
End If
%>
<hr>

<br>
<table align="center">
 <tr>
  <td align="center">
    CopyRight(C) Shaanxi Nationaltax Science and Technology (Group) Corp. Ltd.<br>
    <br>版权所有:陕西国瑞科技(集团)有限公司
  </td>
  <td valign="bottom"><a href="../main.htm">
   <img src="../image/go_home.gif" border="0" width="35" height="70"></a>
  </td>
 </tr>
</table>

<!- Stop the rightkey of mouse-->
<SCRIPT LANGUAGE=JavaScript SRC='../stop_rightkey.js'></SCRIPT>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -