Forums
This topic is locked
CODE NOW!
Posted 24 Mar 2004 16:31:06
1
has voted
24 Mar 2004 16:31:06 Rene Bandsma posted:
Hi, I'am now back with a real cool code:<pre id=code><font face=courier size=2 id=code>
<%
Dim keysearched, keysearchedM, allCharsLessFirst, FirstM
keysearched = "bandsma"
allCharsLessFirst = Len(keysearched) - 1
FirstM = Left(keysearched,1)
if FirstM = "a" Then FirstM = "A"
if FirstM = "b" Then FirstM = "B"
if FirstM = "c" Then FirstM = "C"
if FirstM = "d" Then FirstM = "D"
if FirstM = "e" Then FirstM = "E"
if FirstM = "f" Then FirstM = "F"
if FirstM = "g" Then FirstM = "G"
if FirstM = "h" Then FirstM = "H"
if FirstM = "i" Then FirstM = "I"
if FirstM = "j" Then FirstM = "J"
if FirstM = "k" Then FirstM = "K"
if FirstM = "l" Then FirstM = "L"
if FirstM = "m" Then FirstM = "M"
if FirstM = "n" Then FirstM = "N"
if FirstM = "o" Then FirstM = "O"
if FirstM = "p" Then FirstM = "P"
if FirstM = "q" Then FirstM = "Q"
if FirstM = "r" Then FirstM = "R"
if FirstM = "s" Then FirstM = "S"
if FirstM = "t" Then FirstM = "T"
if FirstM = "u" Then FirstM = "U"
if FirstM = "v" Then FirstM = "V"
if FirstM = "w" Then FirstM = "W"
if FirstM = "x" Then FirstM = "X"
if FirstM = "y" Then FirstM = "Y"
if FirstM = "z" Then FirstM = "Z"
keysearchedM = FirstM & Right(keysearched,allCharsLessFirst)
Dim my_output, doHigh, new_sentence, my_output2
function doHighlight(my_sentence, word_to_highlight, word_to_highlight2)
my_output = "<B><FONT color=#800000><span style=""background-color: #FFFF00"">" & word_to_highlight & "</span></FONT></B>"
doHighlight = replace(my_sentence, word_to_highlight, my_output)
new_sentence = doHighlight
my_output2 = "<B><FONT color=#800000><span style=""background-color: #FFFF00"">" & word_to_highlight2 & "</span></FONT></B>"
doHighlight = replace(new_sentence, word_to_highlight2, my_output2)
End function
' an example of the result
response.write doHighlight("Bandsma is my name", keysearched, keysearchedM)
%>
</font id=code></pre id=code>
Just replace the <i>keysearched = "bandsma"</i> into a Request.URL variabele!
This is working fine by me, just make some changes and you're done!
Replies
Replied 24 Mar 2004 16:32:34
24 Mar 2004 16:32:34 Rene Bandsma replied:
Sorry people.. this is a reply on the HIGHLIGHTING question... and not a topicstart... sorry!
Replied 24 Mar 2004 18:05:45
24 Mar 2004 18:05:45 A B replied:
How would i change this code to incorporate into my code?
code shown from link below
www.4guysfromrolla.com/webtech/code/searchengine.search.asp.html
code shown from link below
www.4guysfromrolla.com/webtech/code/searchengine.search.asp.html