求一个asp处理html下特殊字符的function
如题,在response.Write比如<a>这之类的字符的时候html会触发相应的效果,好像是需要使用类似chr函数的方式输出即可,求一个可以将一个字符串中所有特殊字符...
如题,在response.Write比如<a>这之类的字符的时候html会触发相应的效果,好像是需要使用类似chr函数的方式输出即可,求一个可以将一个字符串中所有特殊字符转换为可直接输出为普通可见字符串的function。。。谢谢
展开
1个回答
2013-08-26
展开全部
<%'//-----------------------------------------字符转换-----------------------------------------
Function HTMLEncode1(fString)
If not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<") fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "<P> ")
fString = Replace(fString, CHR(10), "<BR> ") 'fString=ChkBadWords(fString)
HTMLEncode1 = fString
End if
End function%>
Function HTMLEncode1(fString)
If not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<") fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "<P> ")
fString = Replace(fString, CHR(10), "<BR> ") 'fString=ChkBadWords(fString)
HTMLEncode1 = fString
End if
End function%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询