" />

欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

編程問答

當(dāng)前位置:主頁 > 網(wǎng)絡(luò)編程 > 編程問答 >

如何做一個文本搜索?

來源:本站原創(chuàng)|時間:2020-01-11|欄目:編程問答|點擊: 次

<%
head = "
搜索"
SearchString = Request("SearchString")
count=0

Function UnMapPath( Path )
    UnMapPath = Replace(Mid(Path, Len(Server.MapPath("/")) + 1), "\", "/")<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

' 把當(dāng)前目錄的實際路徑轉(zhuǎn)換為虛擬路徑.
End Function


Function SearchFile( f, s, title )
  Set fo = fs.OpenTextFile(f)
  content = fo.ReadAll

' 把全部文本讀到content.
  fo.Close
  SearchFile = InStr(1, content, S, vbTextCompare) > 0

' 從第一個字符開始檢查content里面是否有S.
  If SearchFile Then

' 如果有,則提出文件title存入變量.
      pos1 = InStr(1, content, "<title>", vbTextCompare)
      pos2 = InStr(1, content, "</title>", vbTextCompare)
      title = ""
      If pos1 > 0 And pos2 > 0 Then

' title標(biāo)記中間的字符.
        title = Mid( content, pos1 + 7, pos2 - pos1 - 7 )
      End If
  End If
End Function

Function FileLink( f, title )
  vPath = UnMapPath( f.Path )

' 獲取路徑.
  If title = "" Then title = f.Name

' 做個鏈接.
  FileLink = "<A HREF=""" &  vPath & """>" & title & "</A>"
  FileLink = "<UL>
·" & FileLink & "</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" Then

' 顯示擴(kuò)展名字為HTM的文件.
        If SearchFile( f, s, title ) Then
            Response.Write FileLink(f, title)
            count=count+1
            Response.Write cstr(count)
        End If
      End If
  Next

  For each sfd In fd.SubFolders
      SearchFolder sfd, s
  Next
End Sub
%>
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=gb_2312-80">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title><%=head%></title>
</head>

<body>

<h1>
星河影動之無敵文本搜索<%=head%></h1>

<hr>

<form action="search.asp" method="Get">
    <p>
請輸入想要搜索的內(nèi)容: <input type="text"
    size="20" name="SearchString" value="<%=SearchString%>"> <input
    type="submit" value="
搜索"> </p>
</form>
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set fd = fs.GetFolder( Server.MapPath("/") ) 

' 設(shè)置開始搜索的路徑.

If SearchString <> "" Then
  Response.Write "<H2>
搜索<font color=red>" & SearchString & "</font>結(jié)果如下:</H2><P>"
  SearchFolder fd,SearchString
End If
%>
<hr>
</body></html>

[1]

上一篇:如何實現(xiàn)網(wǎng)上考試?

欄    目:編程問答

下一篇:如何判斷電子郵件的地址格式是否正確?

本文標(biāo)題:如何做一個文本搜索?

本文地址:http://mengdiqiu.com.cn/a1/bianchengwenda/12105.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有