日期:2014-05-17  浏览次数:21246 次

数据读取到第四条时自动换行怎么实现啊?
sub   ShowAllClass()
if   rsBigClass.bof   and   rsBigClass.eof   then  
response.Write   " 没有任何栏目 "
else
dim   sqlClass,rsClass,strClassName
rsBigClass.movefirst
do   while   not   rsBigClass.eof
strClassName=   " <IMG   height=15   src= 'pic/icon05.gif 'width=15> 【 <a   href= 'Product.asp?BigClassName= "   &   rsBigClass( "BigClassName ")   &   " '> <b> "   &   rsBigClass( "BigClassName ")   &   " </b> </a> 】 <br> <br> "
sqlClass= "select   *   from   SmallClass   where   BigClassName= ' "   &   rsBigClass( "BigClassName ")   &   " '   Order   by   SmallClassID "
Set   rsClass=   Server.CreateObject( "ADODB.Recordset ")
rsClass.open   sqlClass,conn,1,1
do   while   not   rsClass.eof
strClassName=strClassName   &   "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <IMG   height=9   src= 'pic/dot1.gif 'width=9> &nbsp; <a   href= 'Product.asp?BigClassName= "   &   rsClass( "BigClassName ")   &   "&SmallClassName= "   &   rsClass( "SmallClassName ")   &   " '> "   & " <font   color= '#1A52B8 '> "   &   rsClass( "SmallClassName ")   &   " </font> "   & " </a> </font> &nbsp; "
rsClass.movenext
loop
response.write   strClassName   &   " <br> <br> "
rsBigClass.movenext
loop
rsClass.close
set   rsClass=nothing
end   if
end   sub


当SmallClassName数据读到第5条的时候就自动换行到下一行.帮改一下代码。

------解决方案--------------------
sub ShowAllClass()
if rsBigClass.bof and rsBigClass.eof then
response.Write "&nbsp;没有任何栏目 "
else
dim sqlClass,rsClass,strClassName,kk
rsBigClass.movefirst
do while not rsBigClass.eof
strClassName= " <IMG height=15 src= 'pic/icon05.gif 'width=15> 【 <a href= 'Product.asp?BigClassName= " & rsBigClass( "BigClassName ") & " '> <b> " & rsBigClass( "BigClassName ") & " </b> </a> 】 <br> <br> "
sqlClass= "select * from SmallClass where BigClassName= ' " & rsBigClass( "BigClassName ") & " ' Order by SmallClassID "
Set rsClass= Server.CreateObject( "ADODB.Recordset ")
rsClass.open sqlClass,conn,1,1
kk=0
do while not rsClass.eof

strClassName=strClassName & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <IMG height=9 src= 'pic/dot1.gif 'width=9> &nbsp; <a href= 'Product.asp?BigClassName= " & rsClass( "BigClassName ") & "&SmallClassName= " & rsClass( "SmallClassName ") & " '> " & " <font color= '#1A52B8 '> " & rsClass( "SmallClassName ") & " </font> " & " </a> </font> &nbsp; "
kk=kk+1
If kk Mod 5 = 0 Then strClassName=strClas