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

rensh 2002-09-07 03:40:01
asp如何处理备注字段在网页中的显示和保存,回车和换行?
...全文
145 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
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
%>

28,409

社区成员

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

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