关于数组输出的问题?
<%
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”在第三个单元格里,以此类推。但总是报错。
参考答案:一行最多只有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>"
%>