ASP怎么把读出的换行符替换掉,请大侠救命

来源:百度知道 编辑:UC知道 时间:2024/06/17 06:00:50
如题:
=========================代码如下==========
<!--#include file="conn_lxy_nohack.asp"-->
<body oncontextmenu="event.returnValue=false;">

<%
dim iprochina
iprochina=1
set rs_proenchina=server.createobject("adodb.recordset")
rs_proenchina.open"select * from feixin where fasongid=0 order by id desc",conn,1,3
%>

<% do while not rs_proenchina.eof%>

<%
val1=rs_proenchina("name_rk")
val2=rs_proenchina("tel")
val3=rs_proenchina("fax")
val4=rs_proenchina("sj")
val5=rs_proenchina("ip")
%>

<%
fname="moban/mb_mail.txt"
dim replaceweb(4)
replaceweb(0)=val1
replaceweb(1)=val2
replaceweb(2)=val3
replaceweb(3)=val4
replaceweb(4)=val5
set fso=server.createobject("scripting.filesystemobject")

for i=0 to 4

replaceweb(i)=Replace(replaceweb(i),chr(13)," ")
replaceweb(i)=Replace(replaceweb(i),chr(10),"<p/><p>")
replaceweb(i)=Replace(replaceweb(i),CHR(32)," ")
replaceweb(i)="<p>"& replaceweb(i)&"</p>"

FSOFileRead=Replace(FSOFileRead,"$HTMLWEB["&i&"]",replaceweb(i))

next

如果转换成<p></p>的话,那每行就成一个段落了。
用str=Replace(str,"\r\n","");来去除换行符,换行符一般是\r\n

楼上的,你说的可以用么?那个不是js中的吗?asp一般不是默认vbs吗?难道在vbs中也可以使用\r\n??
--------------------
楼主,楼上的说的有道理,成了段落就更不好排版了,不如换成<br>的好
str=replace(str,vbcrlf,"<br>")

content=rs("content")
content=replace(content,"<br>","") '换行符替换为空

ascii码chr(13),chr(32)替换就行了。