请帮看看这段代码.

zengqia 2005-12-01 11:51:35
function htmlencode2(str)
dim result
dim l
if isNULL(str) then
htmlencode2=""
exit function
end if
l=len(str)
result=""
dim i
for i = 1 to l
"对返回的内容进行判定,并对其含有<,>,chr(13),chr(34),&,chr(32),chr(9)进行相应的转化,如chr(13)变为<br>;也就是回车的HTM代码
select case mid(str,i,1)
case "<"
result=result+"<"
case ">"
result=result+">"
case chr(13)
result=result+"<br>"
case chr(34)
result=result+"""
case "&"
result=result+"&"
case chr(32)
'result=result+" "
if i+1<=l and i-1>0 then
if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then
result=result+" "
result=result+" "
end if
else
result=result+" "
end if
case chr(9)
result=result+" "
case else
result=result+mid(str,i,1)
end select
next
htmlencode2=result
end function
%>
...全文
48 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
银狐被占用 2005-12-01
  • 打赏
  • 举报
回复
楼主的问题是什么?
不能是光让看代码吧。。。

而且转换也不用这么麻烦吧。
有很多简单的方法的。
例:replace(expression1,"<","<")
fangq 2005-12-01
  • 打赏
  • 举报
回复
Function R_str(s)
s=replace(s,chr(13),"<br>")
s=replace(s,chr(13),"<br>")
s=replace(s,"<","<")
s=replace(s,"<",">")
s=replace(s,chr(38)," ")
R_str=Trim(s)
End Function

28,391

社区成员

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

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