% Dim i, j, iCols i = 0 '//定義i進行循環 iCols = 3 '//一行有幾列(正整數) Response.Write("table width=""100%"" border=""1"" cellspacing=""2"" cellpadding=""0"">tr>"vbNewLine) '//輸出Table頭和第一個Tr Do While Not oRs.EOF '//開始輸出記錄集 用 For ors.RecordCount Next 也行 If i>0 And i Mod iCols = 0 Then Response.Write("/tr>tr>"vbNewLine) '//如果列數等于 iCols 換行 i = i + 1 Response.Write("td width="""FormatPercent(1 / iCols, 0)""">輸出第 "i" 條記錄/td>"vbNewLine) oRs.MoveNext Loop '//結束輸出記錄集 oRs.Close For j = 1 To iCols -1 '//開始補足空記錄,最多補iCols-1條 If i Mod iCols = 0 Then Exit For '//列數已經夠 iCols 不再輸出 i = i + 1 Response.Write("td width="""FormatPercent(1 / iCols, 0)""">補足第 "j" 條記錄/td>"vbNewLine) Next Response.Write("/tr>/table>"vbNewLine) '//輸出Table尾 %>