Control | data | display
Many times, when we display the contents of a database, we use a few rows or columns to display the data, such as 10 data, to be displayed in 2 or 3 columns per row.
Here is a simple listing code that uses an array to display a few rows of columns in a table, in the hope of helping you.
Dimwwwstr,wwwarr
Wwwstr= "51windows.net|blueidea.com|google.com|yahoo.com|msn.com.cn|csdn.net|ipark.cn|1kg.cn"
Wwwarr=split (wwwstr, "|")
Functionurltest1 (str)
Response.Write ("<ahref=" "".) &str& "" "target=" "_blank" ">" &str& "</a>")
Endfunction
<tableborder= "1" width= "cellpadding=" "2" >
<%calltablebody (wwwarr,3, "Urltest1")%>
</table>
Function code:
Functiontablebody (ARR,COLS,FUNCTIONSTR)
' Arr array
' Cols is the number of columns
' Functionstr function for output content, not NULL
dimallnum,i,j
allnum=ubound (arr)
fori=0to (allnum/cols)
Response.Write (vbtab& "<tr>" &vbnewline)
forj=0to (cols-1)
ij= ( I*COLS+J)
response.write (vbtab&vbtab& "<tdwidth=" "" &formatnumber (100/cols,0 ) & "%" ">")
ifij<=allnumthen
iflen (FUNCTIONSTR) > 0then
execute (arr (ij))
else
response.write (arr (ij))
endif
else
response.write (" ")
endif
response.write ("</td>" &vbnewline)
next
response.write (VbTab& "</tr>" &vbnewline)
next
Endfunction
Functiontest1 (str)
Response.Write ("<divalign=" "Center" ">" &str& "</div>")
Endfunction