<%
Function Replacepic(Str, patrn, supStr)
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Replacepic = regEx.Replace(""&Str&"", ""&supStr&"")
Set regEx = Nothing
End Function
Function picEncode(supString)
Str = supString
If Not IsNull(supString) Then
Str = Replacepic(Str, "alt=(.[^>]*)","")
Str = Replacepic(Str, "onload=(.[^>]*)","")
Str = Replacepic(Str, "onmouseover=(.[^>]*)","")
Str = Replacepic(Str, "onclick=(.[^>]*)","")
Str = Replacepic(Str, "title=(.[^>]*)","")
Str = Replacepic(Str, "title=(.[^>]*)","")
End If
picEncode = Str
End Function
%>
<%=picEncode("<img src='2.gif' onload='javascript:DrawImage(this);' border='0' alt='按此在新窗口打开图片' onmouseover='this.style.cursor='hand';' onclick='window.open(this.src);' /> ")%>
花了一个星期多的时间了,
问题是 当触发到过滤点时 后面一并被过滤了,如何做到灵活点 比如:onload='javascript:DrawImage(this);'过滤时 只过滤到 ' 为止 后面的 border='0' 不在过滤范围中 所以如何能做到只过滤触发点.
希望高手指点!