天枫常用的ASP函数封装如下(7)
Str=Replace(Str,Chr(9),"")
Str=replace(Str,"|","|")
Str=replace(Str,chr(39),"'")
Str=replace(Str,"<","<")
Str=replace(Str,">",">")
Str = Replace(str, CHR(13),"")
Str = Replace(str, CHR(10),"")
FiltrateHtmlCode=Str
End If
End Function
'****************************************************
'函数名:HtmlCode
'作 用:过滤Html标签
'参 数:str ----字符串
'****************************************************
Public function HtmlCode(str)
If Not isnull(str) And str<>"" then
str = replace(str, ">", ">")
str = replace(str, "<", "<")
str = Replace(str, CHR(32), " ")
str = Replace(str, CHR(9), " ")
str = Replace(str, CHR(34), """)
str = Replace(str, CHR(39), "'")
str = Replace(str, CHR(13), "")
str = Replace(str, CHR(10), "")
str = Replace(str, "script", "script")
HtmlCode = str
End If
End Function
'****************************************************
'函数名:Replacehtml
'作 用:清理html
'参 数:tstr ----字符串
'****************************************************
Public Function Replacehtml(tstr)
Dim Str,re
Str=Tstr
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<(p|\/p|br)>"
Str=re.Replace(Str,vbNewLine)
re.Pattern="<img.[^>]*src(=| )(.[^>]*)>"
str=re.replace(str,"[img]$2[/img]")
re.Pattern="<(.[^>]*)>"
Str=re.Replace(Str,"")
Set Re=Nothing
Replacehtml=Str
End Function
'---------------获取客户端和服务端的一些信息-------------------
'****************************************************
'函数名:GetIP
'作 用:获取客户端IP地址
'返回值:客户端IP地址
'****************************************************
内容版权声明:除非注明,否则皆为本站原创文章。