Dim i
i = 0
For Each objFile in objFolder.Files
If Response.IsClientConnected then
If InStr(1,objFile.Name,strSearchText,1) then
Response.Write "<b>»</b> " & objFile.Name & "</a><br>"
bolFileFound = True
i = i - -1
if i = 50 then exit for
End If
End If
Next
Kan man lägga till i detta script att när man söker så ska det komma fram max 50 sökord och inte som det gör nu att om man söker på bokstaven (a) så kommer typ 100 stycken fram. kan man begränsa detta det behöver inte kommma i någon speciell ordning.
Så här ser scriptet ut:::
\<form id=form onSubmit="return form_validator(this)" action="sok.asp?do=sok" method=POST\>
Enter search:
<input type="text" name="searchtext" size="37">
\<input type="submit" value="- search -" name="B1"\>
</form>
<%If Request.QueryString("do") = "sok" Then%>
<b>Search results for: <%=Request("SearchText")%></b><br>
<%Const fsoForReading = 1
'###################################################
'-------MAPPEN FILERNA LIGGER I SOM DU SKA SÖKA BLAND------------
'###################################################
Mappen = Server.MapPath("storagearchive")
Mappen = Server.MapPath("uploads")
MappUrl = Mid(Mappen, InStrRev(Mappen, "\") + 1)
strSearchText = Request("SearchText")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Mappen)
bolFileFound = False
For Each objFile in objFolder.Files
If Response.IsClientConnected then
If InStr(1,objFile.Name,strSearchText,1) then
Response.Write "<b>»</b> " & objFile.Name & "</a><br>"
bolFileFound = True
End If
End If
Next
if Not bolFileFound then Response.Write "Nothing found..."
Set objFolder = Nothing
Set objFSO = Nothing%>
<%End If%>


