Control | data | Show a lot of times, when we display the contents of a database, we use a few rows or columns to display the data, such as 10 pieces of 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.
<%
function Tablebody (ARR,COLS,FUNCTIONSTR)
' Arr array
' Cols is the number of columns
' Functionstr function for output content, not NULL
dim allnum,i,j
allnum = UBound (arr)
for i = 0 to (allnum/cols)
Response.Write (VbTab & "<tr>" & vbNewLine)
for j = 0 to (cols-1)
ij = ( I*COLS+J)
response.write (VbTab & VbTab & "<td width=" "" & FormatNumber (100/cols,0 ) & "%" > "
if ij <= allnum then
if len (functionstr) > 0 Then
execute ("& Functionstr &" (arr (ij))
else
response.write (arr (ij))
end if
else
response.write (" ")
end if
response.write ("</td>" & vbNewLine)
next
response.write (VbTab & "</tr>" & vbNewLine)
next
End Function
function Test1 (str)
Response.Write ("<div align=" "Center" ">" & str & "</div>")
End Function
' Example 1
Dim kk (9)
For k = 0 to 9
KK (k) = K+1
Next
%>
<table border= "1" width= "cellpadding=" 2 ">
<%call tablebody (kk,1, "")%>
</table>
<table border= "1" width= "cellpadding=" 2 ">
<%call tablebody (kk,4, "test1")%>
</table>
<table border= "1" width= "cellpadding=" 2 ">
<%call tablebody (kk,5, "")%>
</table>
<%
Dim Wwwstr,wwwarr
Wwwstr = "51windows.net|blueidea.com|google.com|yahoo.com|msn.com.cn|csdn.net|ipark.cn|1kg.cn"
Wwwarr = Split (Wwwstr, "|")
function Urltest1 (str)
Response.Write ("<a href=" "http://www.") & Str & "" "target=" "_blank" ">" & str & "</a>"
End Function
function Urltest2 (str)
Response.Write ("<button style=" "width:100%;" "onclick=" "window.open" (' http://www. " & Str & "', ', '" "" > "& str &" </button> ")
End Function
%>
<table border= "1" width= "cellpadding=" "2" >
<%call tablebody (wwwarr,3, "Urltest1")%>
</table>
<table border= "2" width= "cellpadding=" 2 "cellspacing=" 2 ">
<%call tablebody (wwwarr,4, "Urltest2")%>
</table>