- search.html -
<HTML>
<BODY>
<FORM METHOD=POST ACTION=""TextSearch.asp"">
Enter text to search for:
<INPUT TYPE=TEXT NAME=SearchText>
<P>
<INPUT TYPE=SUBMIT VALUE=""Procurar"">
</FORM>
</BODY>
</HTML>
- TextSearch.asp -
<HTML><BODY>
<B>Resultado da procura para <%=Request(""SearchText"")%></B><BR>
<font face=""Arial, Helvetica, sans-serif"" size=""-2"">
<%
Const fsoForReading = 1
Dim strSearchText
strSearchText = Request(""SearchText"")
Dim objFSO
Set objFSO = Server.CreateObject(""Scripting.FileSystemObject"")
Dim objFolder
Set objFolder = objFSO.GetFolder(Server.MapPath(""/detran""))
Dim objFile, objTextStream, strFileContents, bolFileFound
bolFileFound = False
For Each objFile in objFolder.Files
If Response.IsClientConnected then
Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading)
strFileContents = objTextStream.ReadAll
If InStr(1,strFileContents,strSearchText,1) then
Response.Write ""<LI><A HREF=""""/detran/"" & objFile.Name & _
"""""">"" & objFile.Name & ""</A><BR>""
bolFileFound = True
End If
objTextStream.Close
End If
Next
if Not bolFileFound then Response.Write ""Nenhuma palavra encontrada...""
Set objTextStream = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>
</font></BODY></HTML>
1 comentários:
[Enviado originalmente em 19/mar/2002 17:12:32]:
Essa busca é muito boa. Me foi muito útil.
Vale a pena vc inserir uma busca em seu site.
Postar um comentário