怎样让数据读到6个的时候自动换行

hrxnoise 2003-08-04 04:23:49
如题原码如下:http://qqere.w117.bizcn.com

...全文
115 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
flashasp 2003-08-05
  • 打赏
  • 举报
回复
不好意思,我误会了你的意思,应该是这样的

<table>
<tr>
<%
i=1
do while not rs.eof
%>
<td><%=rs("classname")%></td>
<%if i = 5 then
response.write "</tr><tr>"
i=0
end if
i=i+1
rs.movenext
loop
%>
</tr>
</table>
flashasp 2003-08-05
  • 打赏
  • 举报
回复
最佳答案:6个一换行,并用表格来排版
-----------------------------------------------
<table>
<tr>
<%
str1 = "a,b,c,d,e,f,g,h,i,j,j,l"
str2 = "a,c,f,g,i"
arrStr1 = Split(str1,",")
arrStr2 = Split(str2,",")
k = 0
For i=0 to UBound(arrStr1)

Response.Write("<td>"&arrStr1(i)&"<input type='checkbox' name='qxx' value="& arrStr1(i) &"")
For j = 0 to UBound(arrStr2)

If Instr(CStr(arrStr1(i)),CStr(arrStr2(j)))>0 Then Response.Write " checked"

Next
k = k + 1

If k mod 6 = 0 Then
Response.Write("></tr><tr>")
Else
Response.Write("></td>" & vbcrlf)
End If
Next

%>

</table>
conner 2003-08-05
  • 打赏
  • 举报
回复
j=0 '定义一个变量用来记录显示的信息条数
do while not rs1.eof
j=j+1 '每循环一次让记录加一
if j mod 6 =0 then '判断是否能被6整除
response.write "<br>" '如果能被6整除换行
end if
%>
<%
if not Rs1.eof then

%>

mpmenu<%=menuid%>.addItem(new mMenuItem(' <span style="line-height: 20px;"><%=Rs1("bigclassname")%>','bigclass.asp?typeid=<%=menuid%>&bigclassid=<%=Rs1("bigclassid")%>','self',false,'<%=Rs1("bigclassname")%>','','','',''));
<%
end if
rs1.movenext
hrxnoise 2003-08-05
  • 打赏
  • 举报
回复
为什么在里面加入
if (i mod 6)=0 then
response.write "<br>"
end if
i=i+1
rs.movenext
出现7个记录
sishuo 2003-08-05
  • 打赏
  • 举报
回复
up
zhuxiaong 2003-08-05
  • 打赏
  • 举报
回复
j=1
do while not rs1.eof
if j mod 6=0 then
response.write "<BR>"
else
response.write 代码
end if
j=j+1
rs1.movenext
loop
..................
%>
pzlk 2003-08-05
  • 打赏
  • 举报
回复
<%if rowcount mod 3 =0 then%></tr><%end if%> <-----------每三个记录一行

pzlk 2003-08-05
  • 打赏
  • 举报
回复
我也是初学者
自己写的,希望对你有用
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="87" id="AutoNumber2" height="114">
<tr>
<%
if rs.eof and rs.bof then
'response.write sql
response.write"没有户型图"
else
i=1
rowcount=1
do while not rs.eof

%>
<td width="179" height="143">
<table width="129">
<tr>
<td width="126">
<p align="center"><a href="huxingdetail.asp?<%= "huxingid=" & rs.Fields.Item("huxingid").Value %>" target="_blank">
<img src=../images/build/<%=(rs.fields.item("picroute").value)%> width="104" height="118"></a></td></tr>
<tr>
<td width="126">
<p align="center"><font size=2><%=(rs.fields.item("picname").value)%></font>
</td>
<tr>
</table>
</td>
<%if rowcount mod 3 =0 then%></tr><%end if%>
<%
i=i+1
rs.movenext
rowcount=rowcount+1
loop
end if
rs.close
%>
</tr>
</table>
meCAD 2003-08-05
  • 打赏
  • 举报
回复
up
t98 2003-08-05
  • 打赏
  • 举报
回复
加在你得rs循环中

sql="select * from xx"
set rs=conn.execute(sql)
dim i=0
while not rs.eof
...
if (i mod 6)=0 then
response.write "<br>"
end if
i=i+1
rs.movenext
wend
hrxnoise 2003-08-05
  • 打赏
  • 举报
回复
还是不知道有谁能够告诉具体加在什么地方吗!
7758iloveu 2003-08-04
  • 打赏
  • 举报
回复
<%

k=0

do while not rs.eof

k=k+1

'你的代码
if k=6 then

response.write "<br>"

k=0

end if


rs.movenext

loop




%>
junsisi 2003-08-04
  • 打赏
  • 举报
回复
不清楚你想把<BR>加在哪,没法帮你改,给你个例子自己瞅瞅~~~

............
if not rs1.EOF then
j=1
do while not rs1.eof
if j mod 6=0 then
response.write 你的代码&"<BR>"
else
response.write 你的代码
end if
i=i+1
rs1.movenext
loop
..................
%>
hrxnoise 2003-08-04
  • 打赏
  • 举报
回复
看看源码,太乱了我不知道放在什么地方,因为我是初学者:)
ceocio 2003-08-04
  • 打赏
  • 举报
回复
使用mod
if i mod 6 =0 then
response.write "<br>"
end if

28,404

社区成员

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

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