I copied a function that strips html and added some extra replaces into the code, but when I call this function in anywhere I get error with this code
stripHTML(objRS("Name")) input are strings, how do I switch or declear the type?
Microsoft VBScript runtime error '800a000d' Type mismatch: 'stripHTML'
--function.asp
function stripHTML(strHTML)
Dim objRegExp, strOutput, tempStr
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<(.|n)+?>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")
strOutput = Lcase(replace(replace(trim(strOutput),"/","-")," ","-"))
strOutput = replace(replace(replace(strOutput,".","-"),"&","-"),",","")
strOutput = replace(replace(strOutput,"--","-"),"---","-")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
end Function
UPDATE
The place I am calling this function is another file that has this page included at top
sometimes this function will be called by another file THIS page is pulling (example : footer template)
How do I make this function Globally accessible?
objRS("Name")may be NULL. You could guard against this in your SQL query:select isnull(Name, '') ...- Bonddo while not objRS.EOFand convert code from something already working. @Bond - vico