刚刚写好的ASP显示HTML代码(转义)函数

作者: 小古 分类: 网站技术 发布时间: 2012-1-21 ė22741 次浏览 61 条评论
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

本文出自 小古Blog,转载时请注明出处及相应链接。

本文永久链接: http://blog.chdz1.com/?post=140

|

1条评论

  1. SEO 2012-04-29 16:41

    不是很理解,挺好,呵呵回复

发表评论:

电子邮件地址不会被公开。 必填项已用*标注

Ɣ回顶部
sitemap