简单教程
提交运行
代码编辑器:
<script runat="server"> Sub submit(sender As Object, e As EventArgs) dim i,j table1.BGColor="yellow" table1.BorderColor="red" for i=0 To table1.Rows.Count-1 for j=0 To table1.Rows(i).Cells.Count-1 table1.Rows(i).Cells(j).InnerHtml="Row " & i next next End Sub </script> <!DOCTYPE html> <meta charset="utf-8" /> <form runat="server"> <table id="table1" border="1" runat="server"> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> <tr> <td>Cell 3</td> <td>Cell 4</td> </tr> </table> <br> <input type="button" value="Change Contents" OnServerClick="submit" runat="server"/> </form>
运行结果: