简单教程
提交运行
代码编辑器:
<script runat="server"> Sub submit(sender As Object, e As EventArgs) Dim row,numrows,numcells,j,i row=0 numrows=cint(rows1.Value) numcells=cint(cells1.Value) for j=1 to numrows Dim r As New HtmlTableRow() row=row+1 for i=1 to numcells Dim c As New HtmlTableCell() c.Controls.Add(New LiteralControl("row " & j & ", cell " & i)) r.Cells.Add(c) next t1.Rows.Add(r) t1.Visible=true next End Sub </script> <!DOCTYPE html> <meta charset="utf-8" /> <form runat="server"> <p>Table rows: <select id="rows1" runat="server"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <br>Table cells: <select id="cells1" runat="server"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <br><br> <input type="submit" value="Display Table" runat="server" OnServerClick="submit"> </p> <table id="t1" border="1" runat="server" visible="false"/> </form>
运行结果: