为什么他不会换行啊

32572 2001-08-20 01:16:50
加精
我用ASP写个留言簿,但读出数据时,他不会自已换行,多长的数据都是一行显示,我该怎样去让他自动换行啊。
...全文
124 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
32572 2001-08-21
  • 打赏
  • 举报
回复
但我要做的是网友的文章自动提交,留言簿啊,都是面向用户的的,不是自已填写的啊。
shlinda 2001-08-21
  • 打赏
  • 举报
回复
在数据库里输入数据的时候,同时按住ctrl 和enter键,可以回车的
然后在ASP中,使用<pre> content </pre>
就可以达到换行的效果了
当然这些都应该放到表格里做
mreachel 2001-08-21
  • 打赏
  • 举报
回复
受不了了
这个问题不是很简单的嘛,第一个兄弟已经给出答案了啊
在输进数据库前,用mystr=replace(mystr,vbcrlf,"<br>")
读出数据库的时候:再用mystr=replace(mystr,"<br>",vbcrlf)
32572 2001-08-20
  • 打赏
  • 举报
回复
都不行啊
32572 2001-08-20
  • 打赏
  • 举报
回复
谢了
各位

但如何固定一个表的宽度,让其不变啊?
落入凡间的猪 2001-08-20
  • 打赏
  • 举报
回复
我接着上面老兄的写一下:
如:content=request("content")
content=replace(content,chr(13),"<br>")
content=replace(content," "," ")
Kandy 2001-08-20
  • 打赏
  • 举报
回复
自动换行?你把数据读到一个固定宽度的表格里自然就自动换行了~~~~~~:)至于回车和空格就需要你向数据库中写数据的时候进行处理:把回车替换成<br>标记,空格替换成 记得用REPLACE函数:)
黄双全 2001-08-20
  • 打赏
  • 举报
回复
不好意我试过了楼上那位写的不能实现
lzhcolor1 2001-08-20
  • 打赏
  • 举报
回复
其实你做这个用表格做最方便了.而且做出来的留言版又好看
只要在Dreamweaver把输出的格式定好.
比如下面的代码所示.
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%do while not rs.eof%>
<tr>
<td>姓名</td>
<td>Email</td>
</tr>
<tr>
<td><%response.write rs("姓名")%></td>
<td><%response.write rs("email")%>
</td>
</tr><%loop%>
</table>
---这就么简单.
jjdelphi 2001-08-20
  • 打赏
  • 举报
回复
给你一个函数,能够使输入和输出的段落格式一样,但不能使字体变化(感谢freezwy):
<%
function htmlencode(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 "<"
result=result+"<"
case ">"
result=result+">"
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
%>
viking 2001-08-20
  • 打赏
  • 举报
回复

<table width=500>

28,391

社区成员

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

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