请高手帮助看下ASP代码,在线等,多谢

来源:百度知道 编辑:UC知道 时间:2024/05/23 00:17:45
您好,我是ASP初学者,下面这段代码我实在头痛,看不明白。麻烦哪位高手帮我加个注释,告诉我这段代码是干什么的。特别是for next 语句里面的代码

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
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

就是一个把文字域控件输入的值转换为HTML编码的函数,比如输入一个回车,就输出一个<br> for 里面是从输入的字符里一个个读取然后判断处理的循环(以mid(字符,位数,1)方式)

加我QQ,现在忙,没时间解释
55967659