刚刚写好的ASP显示HTML代码(转义)函数
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
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
本文出自 小古Blog,转载时请注明出处及相应链接。
本文永久链接: http://blog.chdz1.com/?post=140
1条评论
不是很理解,挺好,呵呵