数据表中有10条数据,id号是自动增长的,1、2、3、4、5、6、7、8、9、10,现在我需要分成两列来显示,也是按照顺序,第一列 1、2、3、4、5 第二列 6、7、8、9、10 而现在我做出来的两列变成 1、3、5、7、9 第二列为:2、4、6、8、10 了,有什么办法每列按照顺序来显示。
------解决方案--------------------
这样写
- VBScript code
Response.Write "<table style='width:100%;'>" Response.Write vbCrLf While Not rs.EOF Response.Write "<tr>" Response.Write vbCrLf For m = 1 To 5 If rs.EOF Then Response.Write "<td> </td>" Else Response.Write "<td>" & rs("id") & "</td>" rs.MoveNext End If Response.Write vbCrLf Next Response.Write "</tr>" Response.Write vbCrLf Wend Response.Write "</table>"
------解决方案--------------------
原理就是这样了,把数据库操作的加进去就行了,把iii =iii+1 这样的改成指针向下移
- VBScript code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <% X = 10 '定义行数 Y = 5 '定义列数 iii = 1 %> <body> <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <%for i=1 to Y%> <td align="center"><table width="98%" border="1" cellpadding="2" cellspacing="1"> <%for j=1 to x%> <tr> <td height="19" align="center"> <% response.write("ID: " & iii) iii = iii + 1 %> </td> </tr> <%Next%> </table></td> <%Next%> </tr> </table> </body> </html>