asp之实现HTML代码转换的函数
在ASP中,可以使用模板从动态网页到静态网页进行转换,其实静态网页可以通过fsofile操作根据模板生成,下文是爱站技术频道小编为您整理的asp之实现HTML代码转换的函数,一起进入下文了解一下吧!
'******************************
'函数:HTMLEncode(reString)
'参数:reString,待编码转换处理的字符串
'作者:阿里西西
'日期:2007/7/15
'描述:对HTML代码进行转换
'示例:HTMLEncode("
欢迎访问
阿里西西
")
'******************************
Function HTMLEncode(reString)
Dim Str:Str=reString
If Not IsNull(Str) Then
Str = UnCheckStr(Str)
Str = Replace(Str, "&", "&")
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, CHR(32), " ")
Str = Replace(Str, CHR(9), " ")
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), "
")
HTMLEncode = Str
End If
End Function
'反转换HTML代码
Function HTMLDecode(reString)
Dim Str:Str=reString
If Not IsNull(Str) Then
Str = Replace(Str, "&", "&")
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, " ", CHR(32))
Str = Replace(Str, " ", CHR(9))
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))
HTMLDecode = Str
End If
End Function
%>
以上就是asp之实现HTML代码转换的函数,更多内容请继续关注爱站技术频道其它相关文章!
上一篇:详解编写ASP类的方法
下一篇:ASP使用MySQL数据库的方法