如何做一个只搜索本网站的引擎?
- 技术交流
- 2024-10-01 10:24:02
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 (" ") 对不起,没有找到你输入的条目或关键词!
end if
Response.Write ("
Response.Write ("
") 现在调用专业搜索引擎 http://www.yahoo.com.cn/
' 任选一个你喜欢的引擎.
Response.Write ("
")
End Sub
%>
[1]
如何做一个只搜索本网站的引擎?由讯客互联技术交流栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“如何做一个只搜索本网站的引擎?”