小古Blog
刚刚写好的ASP显示HTML代码(转义)函数
2012-1-21 小古
Public Function XmlEncode(strText)

Dim aryChars

aryChars = Array(38, 60, 62, 34, 61, 39)

Dim i

For i = 0 To UBound(aryChars)

strText = Replace(strText, Chr(aryChars(i)), "&#" & aryChars(i) & ";")

Next

strText = Replace(strText, Chr(32), " ")

strText = Replace(strText, Chr(9), "    ")

strText = Replace(strText, Chr(10), "<br/>")

strText = Replace(strText, Chr(13), "<br/>") 

strText = Replace(strText, chr(13)&chr(10) , "<br/>") 

XmlEncode = strText

End Function
评论:
SEO
2012-04-29 16:41 回复
不是很理解,挺好,呵呵
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容