接收的时候用server.htmlencode(request.form("text"))处理一下.
显示的时候用以下函数.
function formatstr(str)
str=replace(str,vbCrLf,"<br>")
str=replace(str," "," ")
end function
wrap=soft | hard | off
wrap=soft (default): Text is displayed with wordwrapping and submitted without carriage returns and line feeds.
wrap=hard :Text is displayed with wordwrapping and submitted with carriage returns and line feeds.
wrap=off :Text is displayed without wordwrapping.
function processchar(oldchar)
oldchar=replace(oldchar,"&","&")
oldchar=replace(oldchar," "," ")
oldchar=replace(oldchar,"<","<")
oldchar=replace(oldchar,">",">")
oldchar=replace(oldchar,chr(13),"<br>") '这句可以把回车替换为<br>
oldchar=replace(oldchar,chr(9)," ")
processchar=oldchar
end function
<%
Function coder(str)
Dim result,L,i
If IsNull(str) Then : coder="" : Exit Function : End If
L=Len(str) : result=""
For i = 1 to L
select case mid(str,i,1)
case "<" : result=result+"<"
case ">" : result=result+">"
case chr(34) : result=result+"""
case "&" : result=result+"&"
case chr(13) : result=result+"<br>"
case chr(9) : result=result+" "
case chr(32) : result=result+" "
case else : result=result+mid(str,i,1)
end select
Next
coder=result
End Function