第一次来这里,小m我开始提问题了,关于自动换行的小问题

lg1kg 2003-08-20 11:52:50
比如说像这样内容输入,如何实现文字的自动换行,而不是一行通到底呢?头痛哦……
...全文
30 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
lg1kg 2003-08-26
  • 打赏
  • 举报
回复
我明白了,谢谢
guchenghong 2003-08-22
  • 打赏
  • 举报
回复
<table style="word-break:break-all">
<tr><td>dddddddddddddddddddd</td></tr></table>这样写入的连续字母或数字也会根据你定的宽度自动换行
WalkSing 2003-08-22
  • 打赏
  • 举报
回复
晕,这个代码曾被压缩过的
WalkSing 2003-08-22
  • 打赏
  • 举报
回复
很久以前搜集的作者忘记了
功能可能不是很理想
function AutoWrap(a_strSourceString , a_intSize)

dim l_strDestString

'Èç¹ûÄÚÈÝÖÐÓлسµÔòÍ˳ö
if instr(a_strSourceString , chr(13) + chr(10) ) <> 0 then
AutoWrap = replace(a_strSourceString , chr(13) , "<br>")
AutoWrap = replace( AutoWrap, chr(10) , "")
exit function
end if

'check if valid parameters
' call assert(vartype(a_strSourceString) = 8 , "AutoWrap" , "a_strSourceString must be a string")
'call assert(vartype(a_intSize) = 2 , "AutoWrap" , "a_intSize must be a integer")

dim i
if a_intSize >= len(a_strSourceString) then
l_strDestString = a_strSourceString
else
l_strDestString = left(a_strSourceString , a_intSize)
for i = 1 to len(a_strSourceString) step a_intSize
if instr( i , mid(a_strSourceString , i , a_intSize) , chr(32) ) = 0 _
or instr( i , mid(a_strSourceString , i , a_intSize) , chr(13)+chr(10) )then
l_strDestString = l_strDestString + " " + mid (a_strSourceString , i + 1 , a_intSize)
else
l_strDestString = l_strDestString + mid(a_strSourceString , i + 1 , a_intSize)
end if
next
end if

l_strDestString = replace(l_strDestString , chr(13) + chr(10) , "<br>")
AutoWrap = l_strDestString
end function

changechange 2003-08-22
  • 打赏
  • 举报
回复
style="word-break:break-all"


style="WORD-WRAP:breakword"

还有不好意思问一下,上面这段怎么用呢?

直接加在 <table> 或者 <td> 标签里面啊!
lg1kg 2003-08-22
  • 打赏
  • 举报
回复
麻烦了……呵呵~~
lg1kg 2003-08-22
  • 打赏
  • 举报
回复
<tr>
<td style="word-break:break-all" width="85" valign="middle" height="168" >
<div align="right"><font size="2">内 容:</font></div>
</td >
<td style="word-break:break-all" width="410" valign="middle" colspan="3" height="168">
<textarea style="word-break:break-all" id=textarea1 name=Content rows="9" cols="50"></textarea>
</td >
</tr>

晕~~~怎么没有反应呢?再具体点好吗?
baby678 2003-08-22
  • 打赏
  • 举报
回复
加到你的输入框的代码里面
lg1kg 2003-08-22
  • 打赏
  • 举报
回复
style="word-break:break-all"


style="WORD-WRAP:breakword"

还有不好意思问一下,上面这段怎么用呢?
lg1kg 2003-08-22
  • 打赏
  • 举报
回复
<%
str="DKDKDKDKDKDK" & vbCrLf & "ddddd"
response.write replace(str,vbCrLf,"<BR>")

'vbCrLf 为VBScript代表回车换行符的常数.相当于vbCrLf=chr(13) & chr(10)
%>
这个好像不是自动换行吧~~~算强制的,我的意思是,客户端输入是自动的换行阿,

lg1kg 2003-08-21
  • 打赏
  • 举报
回复
我想实现的是自动换行阿~再问swans一个更笨的问题……,这段代码应该怎么加呢?汗……
luluso 2003-08-21
  • 打赏
  • 举报
回复
设置<br>不就可以换行咯?
设一个表格也可以啊。
gillette 2003-08-21
  • 打赏
  • 举报
回复
style="word-break:break-all"


style="WORD-WRAP:breakword"
ttt2 2003-08-21
  • 打赏
  • 举报
回复
英文字符各数字是不自动换行的

中文字符是自动换行的
ahuiok 2003-08-21
  • 打赏
  • 举报
回复
请严格遵守用表格来控制文本显示,控制单元格宽度后, 默认情况下,会自动换行的~

<BR> 就强制换行了。 当你把一段需要换行的字符串放入数据库又取出时,可以使用上述方法。

你可以测试一下把

<%
str="DKDKDKDKDKDK" & vbCrLf & "ddddd"
response.write replace(str,vbCrLf,"<BR>")
%>
存成1.asp, 在IIS下运行该页。 看到效果。
swans 2003-08-20
  • 打赏
  • 举报
回复
<%
str="DKDKDKDKDKDK" & vbCrLf & "ddddd"
response.write replace(str,vbCrLf,"<BR>")

'vbCrLf 为VBScript代表回车换行符的常数.相当于vbCrLf=chr(13) & chr(10)
%>

28,391

社区成员

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

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