Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

xanburzum

Searchlight do termo de busca

Recommended Posts

Executa uma pesquisa caso insensitve e Searchlight do termo de busca que foi apresentado. Uma palavra inteira ou uma parte pode ser submetido. Em ambos os casos ", se o termo for encontrado, ele é realçado.

 

<%
Dim strContent
	strContent = "Asa Dotzler recomendou que os usuários do Firefox usem o Bing em lugar do Google.<br>Primeiro SP para o SQL Server 2008 Express Edition já está disponível."

	if NOT IsEmpty(Request.Form("fldSearch")) and NOT trim(Request.Form("fldSearch")) = "" then
		set regX = New RegExp
			src = Request.Form("fldSearch")
		regX.Pattern = src
		regX.IgnoreCase = true
		regX.Global = true
		set theString = regX.Execute(strContent)
		For each matchFound in theString
		strContent = Replace(strContent, matchFound.Value, "<span class=""nbgylw"">" & matchFound.Value & "</span>")
		Next
		set regX = nothing
		set theString = nothing
	end if

%>

<HTML>
<HEAD>
<TITLE> Highlighting </TITLE>
<style>
body {font-family: Arial, Verdana, Helvetica, sans-serif; background-color: #FFFFFF;}
.nbgylw {font-family: Arial, Verdana, Helvetica, sans-serif; background-color: #FFFFCC;}
</style>
</HEAD>
<body>
<table cellpadding="0" cellspacing="5" width="100%" border="0">
<tr><td>
<form action="highlight.asp" method="post">
<input type="text" name="fldSearch"> <input type="submit" value="Pesquisar">
</form>
</td></tr>
<tr><td>
<%=strContent%>
</td></tr>
</table>
</BODY>
</HTML>

%>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.