1980coelho Postado Fevereiro 19, 2013 Denunciar Share Postado Fevereiro 19, 2013 (editado) como faco para que o resultado de uma procura a palavra chave apareca em negrito?RESOLUCAO:'Highlight Search ResultsFunction stringReplace(strSearchWithin,strSearchFor)If Len(strSearchWithin) > 0 And Len(strSearchFor) > 0 ThenintStart = 1intFound = InStr(intStart,strSearchWithin,strSearchFor,1)Do While intFound > 0strReplaced = strReplaced & Mid(strSearchWithin,intStart,intFound - intStart) & "<span style='background-color:yellow'>" & mid(strSearchWithin,intFound,len(strSearchFor)) & "</span>"intStart = intFound + len(strSearchFor)intFound = InStr(intStart,strSearchWithin,strSearchFor,1)LoopstringReplace = strReplaced & Mid(strSearchWithin,intStart)ElsestringReplace = strSearchWithinEnd IfEnd FunctionResponse.Write stringReplace(""&rs("Name")&"",Request.Form("search"))--- Editado Fevereiro 19, 2013 por 1980coelho Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
1980coelho
como faco para que o resultado de uma procura a palavra chave apareca em negrito?
RESOLUCAO:
'Highlight Search Results
Function stringReplace(strSearchWithin,strSearchFor)
If Len(strSearchWithin) > 0 And Len(strSearchFor) > 0 Then
intStart = 1
intFound = InStr(intStart,strSearchWithin,strSearchFor,1)
Do While intFound > 0
strReplaced = strReplaced & Mid(strSearchWithin,intStart,intFound - intStart) & "<span style='background-color:yellow'>" & mid(strSearchWithin,intFound,len(strSearchFor)) & "</span>"
intStart = intFound + len(strSearchFor)
intFound = InStr(intStart,strSearchWithin,strSearchFor,1)
Loop
stringReplace = strReplaced & Mid(strSearchWithin,intStart)
Else
stringReplace = strSearchWithin
End If
End Function
Response.Write stringReplace(""&rs("Name")&"",Request.Form("search"))
---
Editado por 1980coelhoLink para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados