Üye Kayıt Üye Giriş

Aranan kelimenin arkaplan rengini değiştirme


Aranan kelimenin arkaplan rengini değiştirme

 
<%
'********************************************************************
' Telif: Chris Trevino
'********************************************************************
Dim strContent
'// İçinde arama yapılacak metin
strContent = "The quick brown fox jumped over the fence.<br>THE QUICK BROWN FOX JUMPED OVER THE FENCE.<br>ThE QuIcK BrOwN FoX JuMpEd OvEr ThE fEnCE."

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>My Highlighting Page</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">&nbsp;<input type="submit" value="Ara">
</form>
</td></tr>
<tr><td>
<%=strContent%>
</td></tr>
</table>
</BODY>

Bilgisayar Dershanesi Ders Sahibi;
Bilgisayar Dershanesi

Yorumlar

Yorum Yapabilmek İçin Üye Girişi Yapmanız Gerekmektedir.

ETİKETLER

x