用ASP做一个TOPCOOL的站内搜索    
该搜索引擎由一个HTM文件一个ASP文件组成,主要是运用FILESYSTEMOBJECT组件来达到目的,功能强大,修改界面以后可以直接拿来使用,当然加上一点自己的东西就更加好了。

searchpage.htm
该HTM文件用来传入条件



ASP搜索引擎范例
























 


高度敏感





 
返回结果



必须包括:

图片

Zip格式
javascript






 



------------------------------------------------------------------------
显示结果的ASP程序
search.asp



'<%=Request("SearchText")%>'的搜索结果


'<%=Request("SearchText")%>'的搜索结果

<%
Const fsoForReading = 1
Dim objFile, objFolder, objSubFolder, objTextStream
Dim bolCase, bolFileFound, bolTagFound
Dim strCount, strDeTag, strExt, strFile, strContent, strRoot, strTag, strText, strTitle, strTitleL
Dim reqImage, reqJavaS, reqLength, reqNumber, reqZip

strFile = ".asp .htm .html .js .txt .css"
strRoot = "/"
strText = Request("SearchText")
strTag = Chr(37) & Chr(62)
bolFileFound = False
bolTagFound = False
If Request("Case") = "on" Then bolCase = 0 Else bolCase = 1
If Request("iImage") = "on" Then reqImage = "If Request("iZips") = "on" Then reqZips = ".zip" Else reqImage = ""
If Request("iJavaS") = "on" Then reqJavaS = "javascript" Else reqImage = ""
If Request("rResults") = "10" Then reqNumber = 10
If Request("rResults") = "25" Then reqNumber = 25
If Request("rResults") = "50" Then reqNumber = 50
reqLength = Request("rLength")

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath(strRoot))

schSubFol(objFolder)

Sub schSubFol(objFolder)
For Each objFile in objFolder.Files
If strCount + 1 > reqNumber or strText = "" Then Exit Sub
If Response.IsClientConnected Then
Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)

strContent = objTextStream.ReadAll

If InStr(1, strContent, strTag, bolCase) Then
Else
If Mid(objFile.Name, Len(objFile.Name) - 1, 1) = "." Then strExt = Mid(objFile.Name, Len(objFile.Name) - 1, 2)
If Mid(objFile.Name, Len(objFile.Name) - 2, 1) = "." Then strExt = Mid(objFile.Name, Len(objFile.Name) - 2, 3)
If Mid(objFile.Name, Len(objFile.Name) - 3, 1) = "." Then strExt = Mid(objFile.Name, Len(objFile.Name) - 3, 4)
If Mid(objFile.Name, Len(objFile.Name) - 4, 1) = "." Then strExt = Mid(objFile.Name, Len(objFile.Name) - 4, 5)
If InStr(1, strContent, strText, bolCase) And _
InStr(1, strContent, reqImage, 1) And _
InStr(1, strContent, reqZips, 1) And _
InStr(1, strContent, reqJavaS, 1) And _
Instr(1, strFile, strExt, 1) Then
If InStr(1, strContent, "", 1) Then strTitle = Mid(strContent, InStr(1, strContent, "<TITLE>", 1) + 7, InStr(1, strContent, "", 1)) Else strTitle = "未命名"

strCount = strCount + 1
Response.Write "

"& strCount &" - " & strTitle & "

"
strTitleL = InStr(1, strContent, "", 1) - InStr(1, strContent, "", 1) + 7</P> <P>strDeTag = ""<BR>bolTagFound = False</P> <P>Do While InStr(strContent, "<")<BR>bolTagFound = True<BR>strDeTag = strDeTag & " " & Left(strContent, InStr(strContent, "<") - 1)<BR>strContent = MID(strContent, InStr(strContent, ">") + 1)<BR>Loop</P> <P>strDeTag = strDeTag & strContent<BR>If Not bolTagFound Then strDeTag = strContent</P> <P>If reqLength = "0" Then Response.Write objFile.Path & "</DD></DL>" Else Response.Write Mid(strDeTag, strTitleL, reqLength) & "...<BR><b><FONT SIZE='2'>URL: " & objFile.Path & " - 上次修改时间: " & objFile.DateLastModified & " - " & FormatNumber(objFile.Size / 1024) & "Kbytes</FONT></b></DD></DL>"<BR>bolFileFound = True<BR>End If<BR>objTextStream.Close<BR>End If<BR>End If<BR>Next<BR>End Sub</P> <P>For Each objSubFolder in objFolder.SubFolders<BR>schSubFol(objSubFolder)<BR>Next</P> <P>If Not bolFileFound then Response.Write "没有匹配结果"<BR>If bolFileFound then Response.Write "<B>搜索结束</B>"</P> <P>Set objTextStream = Nothing<BR>Set objFolder = Nothing<BR>Set objFSO = Nothing<BR>%><BR></BODY></HTML><BR></SPAN></P></span> <p></p> <h3>关联文档</h3> <div class="resource-recommend"> <ul> <li> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=545BC116007BD2B5441FD2E4A53B20F9C08CEDC8" title="DeepSeek 搞钱指令库" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2025/20250403135954_1743659940_1.png" alt="-DeepSeek 搞钱指令库" /> </a> <p></p> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=545BC116007BD2B5441FD2E4A53B20F9C08CEDC8" title="DeepSeek 搞钱指令库" target="_blank">DeepSeek 搞钱指令库</a> </li> <li> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=D84526485B7F0BC20BBC68501AAC28EA70340337" title="T GDWJ 016 公立医院全面预算管理工作指南" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2025/20250403140008_1743652887_1.png" alt="-T GDWJ 016 公立医院全面预算管理工作指南" /> </a> <p></p> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=D84526485B7F0BC20BBC68501AAC28EA70340337" title="T GDWJ 016 公立医院全面预算管理工作指南" target="_blank">T GDWJ 016 公立医院全面预算管理工作指南</a> </li> <li> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=4890F74538B798DB68C5BF16E939EDA11155C8FC" title="人工智能技术发展与应用实践" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2025/20250402173501_1743586449_1.png" alt="史树明-人工智能技术发展与应用实践" /> </a> <p></p> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=4890F74538B798DB68C5BF16E939EDA11155C8FC" title="人工智能技术发展与应用实践" target="_blank">人工智能技术发展与应用实践</a> </li> <li> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=2D67C0C8E632790F9B4E20A8D55AEE236971C55F" title="DeepSeek行业应用案例集解锁" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2025/20250402173521_1743586338_1.png" alt="-DeepSeek行业应用案例集解锁" /> </a> <p></p> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=2D67C0C8E632790F9B4E20A8D55AEE236971C55F" title="DeepSeek行业应用案例集解锁" target="_blank">DeepSeek行业应用案例集解锁</a> </li> <li> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=5A04A63035E3B931DD195A6671F083C4CE2944B3" title="2025AI大模型产业市场前景及投资研究报告" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2025/20250402173535_1743586288_1.png" alt="-2025AI大模型产业市场前景及投资研究报告" /> </a> <p></p> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=5A04A63035E3B931DD195A6671F083C4CE2944B3" title="2025AI大模型产业市场前景及投资研究报告" target="_blank">2025AI大模型产业市场前景及投资研究报告</a> </li> </ul> </div> </div> </div> <div id="sidebar-right"> <div class="sidebar-right-recommend"> <h3>大家都在看</h3> <ul> <li><a href="Detail.aspx?AI=100647" title="一文读懂:模型上下文协议(MCP)- " target="_blank">一文读懂:模型上下文协议(MCP)</a></li> <li><a href="Detail.aspx?AI=100646" title="AI产品经理如何搭建AI业务架构:从基础到应用的三层架构设计- " target="_blank">AI产品经理如何搭建AI业务架构:从基础到应用的三层架构设计</a></li> <li><a href="Detail.aspx?AI=100645" title="智能BI平台架构的全景解析与应用场景- " target="_blank">智能BI平台架构的全景解析与应用场景</a></li> <li><a href="Detail.aspx?AI=100644" title="大模型是怎么被训练出来的?- " target="_blank">大模型是怎么被训练出来的?</a></li> <li><a href="Detail.aspx?AI=100643" title="渠道分析从入门到精通-小黑哥 " target="_blank">渠道分析从入门到精通</a></li> <li><a href="Detail.aspx?AI=100642" title="全面解读DeepSeek蒸馏技术:模型蒸馏和数据蒸馏-马伟说 " target="_blank">全面解读DeepSeek蒸馏技术:模型蒸馏和数据蒸馏</a></li> <li><a href="Detail.aspx?AI=100641" title="一文分享 ChatBI 实践经验- " target="_blank">一文分享 ChatBI 实践经验</a></li> <li><a href="Detail.aspx?AI=100640" title="深度学习五大模型:CNN、Transformer、BERT、RNN、GAN解析-小智 " target="_blank">深度学习五大模型:CNN、Transformer、BERT、RNN、GAN解析</a></li> <!-- 其他推荐项 --> </ul> </div> <div class="sidebar-right-resource"> <h3>推荐文档</h3> <ul> <li> <div class="doc-item"> <div class="doc-thumb"> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=3CA09FABF668BFABB1527BCDF1FEECDFB649FA03" title="众安银行敏捷研发体系建设与提效的理念与实践" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2024/20240923180627_3168102047_1.png" width="130" height="85" alt="-众安银行敏捷研发体系建设与提效的理念与实践" /></a> </div> <div class="doc-title"><a href="http://wenku.ciozj.com/SlideShow.Aspx?G=3CA09FABF668BFABB1527BCDF1FEECDFB649FA03">众安银行敏捷研发体系建设与提效的理念与实践</a></div> </div> </li> <li> <div class="doc-item"> <div class="doc-thumb"> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=E5762CAF963E2DB3FCDD7F330D29D6ED" title="大型网站的数据库架构演变和优化之道" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2016/20160406083514.jpg" width="130" height="85" alt="-大型网站的数据库架构演变和优化之道" /></a> </div> <div class="doc-title"><a href="http://wenku.ciozj.com/SlideShow.Aspx?G=E5762CAF963E2DB3FCDD7F330D29D6ED">大型网站的数据库架构演变和优化之道</a></div> </div> </li> <li> <div class="doc-item"> <div class="doc-thumb"> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=4A1A9550B705A353638950E895F25A598F1D4454" title="大型企业系统可观测性的最佳实践" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2024/20241023135309_22331281175_1.png" width="130" height="85" alt="-大型企业系统可观测性的最佳实践" /></a> </div> <div class="doc-title"><a href="http://wenku.ciozj.com/SlideShow.Aspx?G=4A1A9550B705A353638950E895F25A598F1D4454">大型企业系统可观测性的最佳实践</a></div> </div> </li> <li> <div class="doc-item"> <div class="doc-thumb"> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=45F899C8473F93460D43042D6B3FABA62712BB12" title="离散制造破局之道主数据管理平台重构" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2025/20250320141045_1742450737_1.png" width="130" height="85" alt="-离散制造破局之道主数据管理平台重构" /></a> </div> <div class="doc-title"><a href="http://wenku.ciozj.com/SlideShow.Aspx?G=45F899C8473F93460D43042D6B3FABA62712BB12">离散制造破局之道主数据管理平台重构</a></div> </div> </li> <li> <div class="doc-item"> <div class="doc-thumb"> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=DF0ADC46D6B0D17EAB02F1208A088174F01A484A" title="美团点评酒店用户端系统稳定性建设" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2018/20180404152816_10201_1.png" width="130" height="85" alt="-美团点评酒店用户端系统稳定性建设" /></a> </div> <div class="doc-title"><a href="http://wenku.ciozj.com/SlideShow.Aspx?G=DF0ADC46D6B0D17EAB02F1208A088174F01A484A">美团点评酒店用户端系统稳定性建设</a></div> </div> </li> <li> <div class="doc-item"> <div class="doc-thumb"> <a href="http://wenku.ciozj.com/SlideShow.Aspx?G=AF8DCA00E76CD27EE41178883CD1CC5407FF2064" title="TDSQL智能运维平台扁鹊架构与实践" target="_blank"> <img src="https://data.ciozj.com/UploadResourceImg/Cover/2019/20190527103534_13751_1.png" width="130" height="85" alt="-TDSQL智能运维平台扁鹊架构与实践" /></a> </div> <div class="doc-title"><a href="http://wenku.ciozj.com/SlideShow.Aspx?G=AF8DCA00E76CD27EE41178883CD1CC5407FF2064">TDSQL智能运维平台扁鹊架构与实践</a></div> </div> </li> </ul> </div> </div> </div> <div class="footer"> <input type="submit" name="ctl00$ContentPlaceHolder1$btnFav" value="加收藏" id="ctl00_ContentPlaceHolder1_btnFav" class="footer-btn fav-btn" />   <input type="submit" name="ctl00$ContentPlaceHolder1$btnAddGood" value="点个赞" id="ctl00_ContentPlaceHolder1_btnAddGood" class="footer-btn share-btn" />   <input type="submit" name="ctl00$ContentPlaceHolder1$btnPrev" value="上一篇" id="ctl00_ContentPlaceHolder1_btnPrev" class="footer-btn prev-btn" />   <input type="submit" name="ctl00$ContentPlaceHolder1$btnNext" value="下一篇" id="ctl00_ContentPlaceHolder1_btnNext" class="footer-btn next-btn" />   </div> </form> </body> </html>