asp如何处理备注字段在网页中的显示和保存,回车和换行?

rensh 2002-09-07 03:40:01
asp如何处理备注字段在网页中的显示和保存,回车和换行?
...全文
94 点赞 收藏 9
写回复
9 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
rensh 2002-09-09
谢谢各位!pass
回复
fbj007 2002-09-07
再给你两个:
<%
function unHtml(content)
unHtml=content
if content <> "" then
unHtml=replace(unHtml,"&","&")
unHtml=replace(unHtml,"<","<")
unHtml=replace(unHtml,">",">")
unHtml=replace(unHtml,chr(34),""")
unHtml=replace(unHtml,chr(13),"<br>")
unHtml=replace(unHtml,chr(32)," ")
end if
end function
%>
<%
function HTMLEncode(fString)

fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")

fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
fString = Replace(fString, CHR(10), "<BR>")
HTMLEncode = fString
end function
%>
回复
37du 2002-09-07
那是不是读出来要替换回去啊?
回复
水墨画 2002-09-07
dim gzcl
gzcl=rs("gzcl")
if gzcl <>"" then
gzcl=replace(gzcl,Chr(32)," ")
gzcl=replace(gzcl,VbCrlf,"<br>")
end if
回复
freezwy 2002-09-07
给你个更完整的函数:
<%
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 chr(13)
result=result+"<br>"
case chr(34)
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
%>
回复
cshadow 2002-09-07
<%
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 %>
回复
freezwy 2002-09-07
function changechr(str)
changechr=replace(replace(replace(replace(str,"<","<"),">",">"),chr(13),"<br>")," "," ")
end function
回复
flashasp 2002-09-07
replace(str, chr(13) & chr(10), "<BR>")//回车/换行用<BR>代替
replace(rs("Your字段Name").Value, " ", " ")//空格用 ;代替
回复
saucer 2002-09-07
search the answer in the Solved section, or try in VBScript:
<%
str = replace(rs("Your字段Name").Value, " ", " ")
str = replace(str, chr(13) & chr(10), "<BR>")

Response.Write str
%>
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2002-09-07 03:40
社区公告
暂无公告