36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
<%
|
|
' YOU CAN CALL THE FUNCTION IN THE FOLLO
|
|
' WING WAYS
|
|
mys = "This is a test To find the word you, it will highlight your, "
|
|
w2f = "you"
|
|
Response.Write doHighlight(mys, w2f, "bi")
|
|
Response.Write "<BR>"
|
|
Response.Write doHighlight("This is a test To find the word you, it will highlight your...", "you", "bi")
|
|
%>
|
|
<%
|
|
Function doHighlight(my_sentence, word_to_highlight, my_fn)
|
|
' doHighlight Function
|
|
' Description: Search for occurances of
|
|
' a keyword in a string and highlight them
|
|
' , by either bold, italic or boli-italic
|
|
' Inputs: String you want searched, word
|
|
' to highlight, and the type of highlight
|
|
' to perform.
|
|
' Types of highlight functions: b=bold;
|
|
' i=italic; bi=bold-italic
|
|
' Output: Returns the string with highli
|
|
' ghting.
|
|
Select Case LCase(my_fn)
|
|
Case "b"
|
|
my_output = "<B>" & word_to_highlight & "</B>"
|
|
doHighlight = Replace(my_sentence, word_to_highlight, my_output)
|
|
|
|
Case "i"
|
|
my_output = "<I>" & word_to_highlight & "</I>"
|
|
doHighlight = Replace(my_sentence, word_to_highlight, my_output)
|
|
Case "bi"
|
|
my_output = "<I><B>" & word_to_highlight & "</B></I>"
|
|
doHighlight = Replace(my_sentence, word_to_highlight, my_output)
|
|
End Select
|
|
End Function
|
|
%> |