作业内容:
写一个函数,基本实现HTMLEncode()方法的功能(提示:使用Replace函数替换"&. >, <"为对应的字符实体)
作业要求:上传代码及运行结果截图
未用函数之前
使用函数之后
<%
dim str
str="<br><h1>666666</h1><br>"
str=Server.HtmlEncode(str)
%>
<%=str%>
使用Replace函数替换"&. >, <"为对应的字符实体
<%
dim str
str="<br><h1>666666</h1><br>"
str=HtmlEncode(str)
function HTMLEncode(fstring)
fstring=replace(fstring,">",">")
fstring=replace(fstring,"<","<")
fstring=replace(fstring,CHR(32)," ")
fstring=replace(fstring,CHR(13),"")
fstring=replace(fstring,CHR(10)&CHR(10),"</p ><p>")
fstring=replace(fstring,CHR(10)&CHR(10),"")
HTMLEncode=fstring
end function
%>
<%=str%>