Ir para conteúdo
Fórum Script Brasil
  • 0

(resolvido) Search ..


1980coelho

Pergunta

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 1980coelho
Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Visitante
Este tópico está impedido de receber novos posts.


  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...