我现在有一个数组,打比方说吧:
arr(0) = <td> 0023 </td> <td> 元素2 </td> <td> 1.34 </td>
arr(1) = <td> 0003 </td> <td> 元素5 </td> <td> 1.05 </td>
arr(2) = <td> 0014 </td> <td> 元素1 </td> <td> 0.02 </td>
for i = 0 to 2
response.write arr(i)
next
应该怎么排序呢,比如我现在想以第一个表格的数字为排序依据,然后显示出来,应该怎么弄.
------解决方案--------------------
<%
dim arr(3,3)
dim i,temp,col
arr(0,0) = "1 "
arr(0,1) = "4 "
arr(0,2) = "3 "
arr(1,0) = "9 "
arr(1,1) = "2 "
arr(1,2) = "8 "
arr(2,0) = "6 "
arr(2,1) = "7 "
arr(2,2) = "5 "
function test(col)
for j = 0 to col
for i = 0 to 2
if arr(i,col) < arr(i+1,col) then
temp = arr(i+1,0)
arr(i+1,0) = arr(i,0)
arr(i,0) = temp
temp1 = arr(i+1,1)
arr(i+1,1) = arr(i,1)
arr(i,1) = temp1
temp2 = arr(i+1,2)
arr(i+1,2) = arr(i,2)
arr(i,2) = temp2
end if
next
next
test = arr
end function
call test(0)
for x = 0 to 2
for y = 0 to 2
response.write arr(x,y)& "| "
next
response.write " <br> "
next
%>