用replace函数,不过要在数据输入数据库之前!
a=replace(a," "," ")
现在酷吧!
nei=replace(nei,"<","<")
nei=replace(nei,">",">")
nei=replace(nei,"'","<|>")
nei=replace(nei,vbCrLf,"<br>")
nei=replace(nei," "," ")
--------------------------------------------------------------------------------
大好男儿光争日月,精忠魂魂气壮山河!
happyyou
终级用户
积分:1269
发贴:332
来自:北京
注册:2000-08-03
发表于 2001-03-19 17:06:51
--------------------------------------------------------------------------------
下面的一段代码可以很好的解决也些这方面的问题
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
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+" "
else
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
%>
那你再用那个函数再倒着搞一次不就得了吗?