In almost every site we have to use programs to output lists: News listings, product lists, and so on, the way the output is different from the content, for news listings, usually a row of the cycle output; For a product list, the output of one cell is usually one cell. Below we will use ASP to output a five-element four-column table.
1, one line of output
The following are the referenced contents: <% Response.Write ("<table border=" "1" "Width=" ">") For I=1 to 5 Response.Write ("<tr><td> </td><td> </td><td> </td><td> </td>" </tr> ") Next Response.Write ("</table>") %> |
There's nothing to talk about, everyone can see it.
2, the output of a cell cell
The following are the referenced contents: <% Response.Write ("<table border=" "1" "Width=" ">") For I=1 to 18 If I mod 4 = 1 Then Response.Write ("<tr>") Response.Write ("<td> </td>") If I mod 4 = 0 Then Response.Write ("</tr>") Next ' Complement cell i = I-1 If I mod 4<>0 Then For J=1 to 4-i MoD 4 Response.Write ("<td> supplement </td>") Next Response.Write ("</tr>") End If Response.Write ("</table>") %>
|
This side needs to explain: Many online output n row n column table ASP does not consider the last row of the number of columns is complete, that is, there is no upper part of the complement, the results of the output of a defective table. The details of the problem, although not small, but still want to pay attention to.