Floodster39
IS-IT--Management
thread333-863709
I've been trying to implement the code in the above thread but I'm getting an error when trying to call it.
The error is "Wrong number of arguments or invalid property assignment: 'HighLight'"
The function I've copied is below
I am then calling it by using the below in my page
Can anybody spot anything glaringly obvious??
Thanks
I've been trying to implement the code in the above thread but I'm getting an error when trying to call it.
The error is "Wrong number of arguments or invalid property assignment: 'HighLight'"
The function I've copied is below
Code:
Function HighLight(TextIn, TextToHighlight, bAll)
dim i,WordArr,TextOut,bHL,bHL2,bNoHL
const HLStyle = "<span style=""color:red;font-weight:bold;background-color:#FFFFCC"">"
const HLStyle2 = "<span style=""color:blue;font-weight:bold;background-color:silver"">"
WordArr = Split(TextIn," ")
for i = 0 to Ubound(WordArr)
bHL = False
bHL2 = False
if lcase(WordArr(i)) = "<a" then bNoHL = true
if not bNoHL then
if WordArr(i) = TextToHighlight then bHL = True ' highlight this word
if PunctMarks(right(WordArr(i),1),"[.,]") then 'check for full stop or comma
if TextToHighlight = left(WordArr(i),len(WordArr(i))-1) then bHL = True
' if word matches ignoring the last char highlight it
end if
if bAll then
' highlight all instances
if InStr(WordArr(i),TextToHighlight) <> 0 then bHL2 = True
end if
if bHL then
TextOut = TextOut & " " & HLStyle & WordArr(i) & "</span>"
elseif bHL2 then
TextOut = TextOut & " " & HLStyle2 & WordArr(i) & "</span>"
else
TextOut = TextOut & " " & WordArr(i)
end if
end if
if lcase(WordArr(i)) = "</a>" then bNoHL = false
next
HighLight = TextOut
End Function
function PunctMarks(strIn, Pattern)
dim objRE
set objRE = New RegExp
objRE.pattern = Pattern
PunctMarks = objRE.Test(strIn)
end function
I am then calling it by using the below in my page
Code:
<%=HighLight("texttosearch", "text", true)%>
Can anybody spot anything glaringly obvious??
Thanks