濮阳杆衣贸易有限公司

主頁 > 知識(shí)庫 > 如何做一個(gè)文本搜索?

如何做一個(gè)文本搜索?

熱門標(biāo)簽:400電話是怎么申請(qǐng) 重慶400電話哪里辦理 教育機(jī)構(gòu)地圖標(biāo)注 自適應(yīng)地圖標(biāo)注 武漢如何辦理400電話 遼寧營銷智能外呼系統(tǒng)價(jià)格多少 語音電銷機(jī)器人視頻 推銷電話機(jī)器人怎么打電話的 常州智能外呼電銷機(jī)器人如何

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

Function UnMapPath( Path )
    UnMapPath = Replace(Mid(Path, Len(Server.MapPath("/")) + 1), "\", "/")

' 把當(dāng)前目錄的實(shí)際路徑轉(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

' 從第一個(gè)字符開始檢查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

' 做個(gè)鏈接.
  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>
星河影動(dòng)之無敵文本搜索%=head%>/h1>

hr>

form action="search.asp" method="Get">
    p>
請(qǐng)輸入想要搜索的內(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]

標(biāo)簽:襄陽 朔州 遵義 雞西 柳州 威海 中山 邯鄲

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《如何做一個(gè)文本搜索?》,本文關(guān)鍵詞  如何,做,一個(gè),文本,搜索,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《如何做一個(gè)文本搜索?》相關(guān)的同類信息!
  • 本頁收集關(guān)于如何做一個(gè)文本搜索?的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    清水县| 舞钢市| 大同市| 星子县| 昌邑市| 乌什县| 湖口县| 克什克腾旗| 墨竹工卡县| 巴林右旗| 西充县| 韩城市| 台山市| 仁布县| 和龙市| 清丰县| 南漳县| 西安市| 西吉县| 二手房| 福清市| 崇明县| 清流县| 霍林郭勒市| 阜南县| 西丰县| 县级市| 静安区| 鄂尔多斯市| 武胜县| 安泽县| 沾益县| 河津市| 广丰县| 天水市| 镇江市| 嘉峪关市| 肥乡县| 泽普县| 佛冈县| 镇平县|