ASP里的do while 语句如何做多列多行--下是代码:
<%dimNclasslie,classlie,classidSetNclasslie=Server.CreateObject("ADODB.Recordset")sql...
<%
dim Nclasslie,classlie,classid
Set Nclasslie =Server.CreateObject("ADODB.Recordset")
sql="select top 9 * from jle_class1 order by paixu desc"
Set classlie = Server.CreateObject("ADODB.Recordset")
classlie.open sql,conn,1,1
if not classlie.eof then
ki=0
do while not classlie.eof
ki=ki+1
classid=classlie("id")%>
....
<table> '中间是个循环体
</table>
......
<%
classlie.movenext
loop
end if
%>
请教高手,这样的效果是要么是一行多列、要么是多行一列,怎么实现多行多列呢?还有有没有关于IF、 FOR、do while 语句的教程我想研究下
如果问题问的不太清楚,我发全部代码,感谢帮助 展开
dim Nclasslie,classlie,classid
Set Nclasslie =Server.CreateObject("ADODB.Recordset")
sql="select top 9 * from jle_class1 order by paixu desc"
Set classlie = Server.CreateObject("ADODB.Recordset")
classlie.open sql,conn,1,1
if not classlie.eof then
ki=0
do while not classlie.eof
ki=ki+1
classid=classlie("id")%>
....
<table> '中间是个循环体
</table>
......
<%
classlie.movenext
loop
end if
%>
请教高手,这样的效果是要么是一行多列、要么是多行一列,怎么实现多行多列呢?还有有没有关于IF、 FOR、do while 语句的教程我想研究下
如果问题问的不太清楚,我发全部代码,感谢帮助 展开
2个回答
展开全部
专门给你写了个多行多列的例子,希望对你有用。
<%
response.write "<table width='200' border='1'>"
i=1
do while i<10
if (i+2) mod 3 =0 then response.write "<tr>"
response.write "<td>"&i&"</td>"
if (i) mod 3 =0 then response.write "</tr>"
i=i+1
loop
response.write "</table>"
%>
<%
response.write "<table width='200' border='1'>"
i=1
do while i<10
if (i+2) mod 3 =0 then response.write "<tr>"
response.write "<td>"&i&"</td>"
if (i) mod 3 =0 then response.write "</tr>"
i=i+1
loop
response.write "</table>"
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询