菜鸟学堂
在线运行
源代码
<script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) dim rows,cells,j,i rows=3 cells=2 For j=0 To rows-1 dim r As New TableRow() For i=0 To cells-1 dim c As New TableCell() c.Controls.Add(New LiteralControl("row " & j & ", cell " & i)) r.Cells.Add(c) Next Table1.Rows.Add(r) Next End Sub </script> <!DOCTYPE html> <html> <body> <form runat="server"> <asp:Table id="Table1" BorderWidth="1" GridLines="Both" runat="server" /> </form> </body> </html>
运行结果
在线运行
菜鸟学堂 edu.jb51.net