htmlencode问题,希望大家能深入探讨!!!!!!!!!

huiqun 2005-05-27 11:26:31
昨晚,再次研究将代码显示的问题,遇到一个问题
希望高手能给解决:

==========================================
<%
function htmlencode2(strcontent)
dim result
dim le
if isnull(strcontent) then
result=""
exit function
end if
le=len(strcontent)
select case mid(strcontent,i,1)
case "<"
result=result+">"
case ">"
result=result+"<"
case "&"
result=result+"&"
case chr(34)
result=result+"""
case chr(32)
---------------------------------------------------------------------------------------
if i+1<le and i-1>0 then
if mid(strcontent,i+1,1)=chr(32) or mid(strcontent,i-1,1)=chr(32) or mid(strcontent,i+1,1)=chr(9) or mid(strcontent,i-1,1)=chr(9) then
result=result+" "
else
result=result+" "
end if
else
result=result+" "
end if
------------------------------------------------------------------------------------------
这里不明白,为什么,已经判断过了,还判断一回呢???

---------------------------------------------------------------------------------------
else
result=result+mid(strcontent,i,1)
end select
end function

%>
==========================================
...全文
79 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
huiqun 2005-05-28
  • 打赏
  • 举报
回复
终于明白啦
liugod 2005-05-28
  • 打赏
  • 举报
回复
高手认为, 不知道你要显示什么
lyexcel 2005-05-27
  • 打赏
  • 举报
回复
不需要自己写吧? Server.HTMLEncode() 已经提供了API啊!
YoYo_Net 2005-05-27
  • 打赏
  • 举报
回复

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧