主题:  ASP不能正确显示换行和分段----求高手帮帮忙......

luminme

职务:普通成员
等级:1
金币:0.0
发贴:7
#12006/1/1 2:10:32
用ASP往数据库里添加了一编文章之后却不会正确显示段落和换行,一定要手动添加<br>或者是<p></p>,如果是一大篇文章的话那就很烦,我把代码贴出来,请问各位大虾帮帮忙啦。。。。谢谢!!

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/tnkx.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("ID" <> "" Then
Recordset1__MMColParam = Request.QueryString("ID"
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_tnkx_STRING
Recordset1.Source = "SELECT * FROM [langyu tnkx] WHERE ID = " + Replace(Recordset1__MMColParam,

"'", "''" + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>团内快讯</title>
<style type="text/css">
<!--
body {
    background-image: url(../files/beijing.gif);
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    font-size: 13px;
    line-height: 22px;
}
.lianjie {    font-size: 13px;
    color: #002800;
    text-decoration: none;
}
.hanju {
    font-size: 13px;
    line-height: 21px;
    text-decoration: none;
}
a:link {
    font-size: 13px;
    color: #002800;
    text-decoration: none;
}
a:visited {
    font-size: 13px;
}
a:hover {
    font-size: 13px;
    color: #AE6800;
    text-decoration: underline;
}
.biaoti {
    font-size: 15px;
    line-height: 23px;
    color: #F20000;
    text-decoration: none;
}

-->
</style></head>

<body>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td width="768" height="143" valign="top"><table width="100%" border="0" cellpadding="0"

cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="768" height="143"><img src="../files/tnkx%20banner.jpg" width="768"

height="143"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="63" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="768" height="63"><object classid="clsid27CDB6E-AE6D-11cf-96B8-

444553540000"

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"

width="768" height="63" align="top">
<param name="movie" value="../files/tnkx%20daohan.swf">
<param name=quality value=high>
<embed src="../files/tnkx%20daohan.swf" width="768" height="63" align="top"

quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?

P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
</object></td>
</tr>
</table></td>
</tr>
<tr>
<td height="404" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"

background="../files/tnkx%20left%20down.gif">
<!--DWLayoutTable-->
<tr>
<td width="192" height="404" valign="top"><table width="100%" border="0"

cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="192" height="404" background="../files/tnkx left.gif">&nbsp;</td>
</tr>
</table></td>
<td width="576" valign="top"><table width="100%" border="0" cellpadding="0"

cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="576" height="404" valign="top"><table width="100%" border="0"

cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td width="576" height="404" valign="top"><table width="100%" border="0"

cellpadding="10" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="576" height="404" valign="top"><p align="center"><span

class="biaoti"><br>
<%=(Recordset1.Fields.Item("tnkx bt".value)%></span><br>
                            发表于:<%=(Recordset1.Fields.Item

("tnkx jrsj".value)%> </p> <p><%=(Recordset1.Fields.Item("tnkx

nr".value)%></p> <p><%=(Recordset1.Fields.Item("tnkx tp".value)%

></p></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="31" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="768" height="31"><img src="../files/yqlj.gif" width="768" height="32"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="1"></td>
</tr>
<tr>
<td height="60" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"

class="hanju">
<!--DWLayoutTable-->
<tr>
<td width="768" height="60" valign="middle" bgcolor="#EEEEE7"><div

align="center">Copyright @ 2004 共青团广东外语艺术职业学院委员会 联系电话:020-37081387 <br>
技术支持:院团委网络部 |<a href="mailto:luminme@163.com" class="lianjie">联系站长</a>|

</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>



luminme

职务:普通成员
等级:1
金币:0.0
发贴:7
#22006/1/1 2:15:26
请各位帮帮忙,我弄了几天都弄不好,哈哈,菜鸟就是菜鸟,谢谢各位了!!!!!!!



luminme

职务:普通成员
等级:1
金币:0.0
发贴:7
#32006/1/1 13:14:19
呜呜呜。。。。。。。。。。。。。。
怎么没人回答啊。。。。好急。。。。。。。。。
各位行行好啊。。。。。。。。。。。。



三仙半

职务:普通成员
等级:1
金币:0.0
发贴:241
#42006/1/24 18:46:27
你查一下VBS的帮助,我给你发上去
相关文件(rar):点这儿打开
用replace函数。
基本思路这样做:
'aaa是你的文章,包含空格和回车
aaa = repace(aaa,chr(13),"<BR>")
aaa = repace(aaa," ","&nbsp;")


闭起眼睛看人生

三仙半

职务:普通成员
等级:1
金币:0.0
发贴:241
#52006/2/2 12:40:39
zys59在上个帖子中说
引用:
你查一下VBS的帮助,我给你发上去
相关文件(rar):点这儿打开
用replace函数。
基本思路这样做:
'aaa是你的文章,包含空格和回车
aaa = repace(aaa,chr(13),"<BR>")
aaa = repace(aaa," ","&nbsp;")


抱歉, repace应该是replace


闭起眼睛看人生