一个简单问题,请高手帮忙看看

jtnwl 2010-07-28 12:51:19
我现在想控制 每行字数,多余字数自动换行

<%=rs("内容")%> 
控制内容字段输出是每行显示10个字,超过10个自动换行

我不想使用 宽度 来控制每行的字数 例如
style="width:100px;overflow: hidden; l"  或 TD DIV 的 width  


请问有没有别的方法 JS 或者 CSS 都可以,

控制每行10个汉字,超过10个自动换行,直到全部输出,

网上找了很多都是用……号来省去多余的,我需要多余用不要用……号,超过10个字自动换行
...全文
116 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
超维电脑科技 2010-07-29
  • 打赏
  • 举报
回复
高手出招了我就观摩了
alenk 2010-07-29
  • 打赏
  • 举报
回复
好多答案啊,呵呵,可以批作业了。来学习的,O(∩_∩)O~
Dogfish 2010-07-28
  • 打赏
  • 举报
回复
10个10个地截取显示。
jtnwl 2010-07-28
  • 打赏
  • 举报
回复
谢谢版主,哈

可是提示错误,

Microsoft VBScript 编译器错误 错误 '800a0414'

调用子程序时不能使用括号

/index.asp,行 9
  • 打赏
  • 举报
回复
<%
str="啊打打双打的阿飞的动感巅峰思维242assdfsfsdfsfsfsfsfdgdfhfgjhfgjghjghjghjghjgjghjghjghjghjgj海关监管和加工环节个人特容易让用户放号风格"
if len(str) mod 10 =0 then
x=int(len(str)/10)
else
x=int(len(str)/10)+1
end if
for i=1 to x
response.write mid(str,(i-1)*10,10) & "<br>"
next
%>
jtnwl 2010-07-28
  • 打赏
  • 举报
回复
谢谢楼上两位,可是我的问题还是没有解决

<%
for i=1 to int(len(rs("内容"))/10)+1
response.write mid(rs("内容"),(i-1)*10+1,10) & "<br>"
next
%>

输出后全部是 空白阿 <br>

还有什么其他方法吗?
ahbkj 2010-07-28
  • 打赏
  • 举报
回复
<%
for i=1 to int(len(rs("内容"))/10)+1
response.write mid(rs("内容"),(i-1)*10+1,10) & "<br>"
next
%>
yaoshanghuan 2010-07-28
  • 打赏
  • 举报
回复
偶尔看到的,关于换行与不换行的属性介绍
希望能帮到你
http://www.cftea.com/c/2010/02/NV2ECKUJL2ZOXZK7.asp
lovebaby 2010-07-28
  • 打赏
  • 举报
回复
给你个函数试试.
'**************************************************
'函数名:gotTopic
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
'返回值:截取后的字符串
'**************************************************
function gotTopic(str,strlen)
if str="" then
gotTopic=""
exit function
end if
strlen = Cint(strlen)
dim l,t,c, i
str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<")
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
gotTopic=left(str,i)&"…"
exit for
else
gotTopic=str
end if
next
gotTopic=replace(replace(replace(replace(gotTopic," "," "),chr(34),"""),">",">"),"<","<")
end function
  • 打赏
  • 举报
回复
<%
str="啊打打双打的阿飞的动感巅峰思维242assdfsfsdfsfsfsfsfdgdfhfgjhfgjghjghjghjghjgjghjghjghjghjgj海关监管和加工环节个人特容易让用户放号风格"
if len(str) mod 10 =0 then
x=int(len(str)/10)
else
x=int(len(str)/10)+1
end if
for i=1 to x
j=i-1
response.write mid(str,j*10,10) & "<br>"
next
%>

改下啊

28,409

社区成员

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

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