您现在的位置是:网站首页> 编程资料编程资料
如何做一个只搜索本网站的引擎?_编程10000问_
2023-05-25
140人已围观
简介 如何做一个只搜索本网站的引擎?_编程10000问_
searchfiles.html
请输入条目或关键词 type="submit" value="搜索">
searchfiles.asp
<%
SearchTerm = request.form("term")
Novalid=" a b c d e f g h i j k l m n o p q r s t u v w x y z yes no and more"
NovalidResponse ="你输入的内容过于简单,请返回重试!"
if instr(SearchTerm,Novalid)=0 then
Response. Write ("
FolderName= "FolderName"
ShowList()
else
Response.Write NovalidResponse
End if
SearchResponse=""
%>
<%
Sub ShowList()
FolderToCheck = server.mappath("\") &"/" & FolderName & "/"
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(FolderToCheck)
Set fc = f.Files
For Each f1 in fc
Wfile = f1.name
if right(Wfile, 5)=".html" OR right(Wfile, 4)=".htm" then
Wfile2 = FolderToCheck & Wfile
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(Wfile2)
ct = a.ReadAll
a.close
ct2=lcase(ct)
SearchTerm2 = lcase(SearchTerm)
if instr(ct2,SearchTerm2)>0 then
if instr(ct,"")>0 then
longitud=instr(ct,"")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"
longitud=longitud2 -longitud -6
ct=right(ct,longitud)
else
if instr(ct,"
longitud=instr(ct,"")
longitud=longitud -1
ct=left(ct,longitud)
longitud2=len(ct)
longitud=instr(ct,"
longitud=longitud2 -longitud -6
ct=right(ct,longitud)
end if
end if
SearchResponse= SearchResponse +" " "+ ct + " VALIGN=MIDDLE>" + " More
longitud=0
ct=""
end if
end if
Next
Response.Write ("
Response.Write ("
") 搜索结果
Response.Write ("")
if SearchResponse<>"" then
Response.Write SearchResponse
else
Response.Write ("对不起,没有找到你输入的条目或关键词
相关内容
点击排行
本栏推荐
