■□■□■ 怎么把text输入中的回车变成“
”???

AceZLB 2003-10-19 02:49:14
如题
每次输入之后回车就没了,htmlencode只能变 <>" 之类的,不能识别空格和回车,空格replace一下就可以了,回车怎么识别呢?
谢谢啦
...全文
47 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
黑马 2003-10-19
  • 打赏
  • 举报
回复
学习
qjqmoney 2003-10-19
  • 打赏
  • 举报
回复
<%
function htmlContent(fString)
if fString<>"" and not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, " ", chr(32))
fString = Replace(fString, "</P><P>", CHR(10))
fString = Replace(fString, "<BR>", CHR(10))
fString = replace(fString,"<p>","")
fString = replace(fString,"<p","<")
fString = replace(fString,"</P>",CHR(10))
fString = replace(fString,"[[","<")
fString = replace(fString,"]]",">")
htmlContent=fString
else
htmlContent=""
end if
end function
%>
bineon 2003-10-19
  • 打赏
  • 举报
回复
用楼上的函数比较好

——————————————————————————————————
www.91asp.cn
有时间到这里找资料找书籍,你会发现asp以及.net很容易!
前提是你努力学习!
tommerxx 2003-10-19
  • 打赏
  • 举报
回复
<%function htmlencode(str)
dim result
dim l
if isNULL(str) then
htmlencode=""
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
htmlencode=result
end function%>

textcontent = htmlencode(request.form("inputbox"))
nolonely 2003-10-19
  • 打赏
  • 举报
回复
content=replace(request.form("content"),vbcrlf,"<br>")
angelheavens 2003-10-19
  • 打赏
  • 举报
回复
回车:replace(str,"<br>",chr(13)&chr(10))
黑马 2003-10-19
  • 打赏
  • 举报
回复
回车:yourStr.replaceAll("\r","<br/>");
空格:yourStr.replaceAll(" "," ");

28,390

社区成员

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

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