关于数组输出的问题?

来源:百度知道 编辑:UC知道 时间:2024/05/15 17:54:11
<%
response.write"<table><tr>"
str=(Recordset1.Fields.Item("shuzu1").Value)'是1,3,4,7
arr=split(str,",")
for kj= 0 to ubound(arr)
j = 1 to 10
if CInt(arr(kj)) = CInt(j) then
response.write "<td>" & arr(kj) & "</td>"
else
response.write "<td></td>"
end if
next
response.write"</tr></table>"
%>
我想输出表格为:“1”在第一个单元格里,“3”在第三个单元格里,以此类推。但总是报错。
谢谢weiweiok!问题基本解决了。但还有两点小问题:
一、页面里每行是10个单元格,而每组数据中最大的数可能比“10”小,这样页面中最大数小于10的这一行的最后几个单元格显示不出来,页面很难看。
二、个别数据由于录入原因,排序混乱,这样输出到页面也是如此,怎样解决由小到大按顺序排列。
再次感谢weiweiok!!! 谢谢

一行最多只有10个啊...不早说,那就更简单了,已修改:

<%
response.write"<table border=1><tr>"
str=(Recordset1.Fields.Item("shuzu1").Value)'是1,3,4,7
arr=split(str,",")
for i=1 to 10
n="*"
for j=0 to ubound(arr)
if cint(arr(j))=i then n=cint(arr(j))
next
response.write "<td>"&n&"</td>"
next
response.write"</tr></table>"
%>