标题:哪位大虾能帮我研究一下下面这段代码错在哪里了,谢谢了
取消只看楼主
luohaifeng
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-1-8
 问题点数:0 回复次数:1 
哪位大虾能帮我研究一下下面这段代码错在哪里了,谢谢了
<script language ="vb" runat = "server">
     Sub Page_Load(sender As Object,e As EventArgs )
         If not Page.IsPostBack then
             MySelect1.Items.Add("1")
             MySelect1.Items.Add("2")
             MySelect1.Items.Add("3")
             MySelect1.Items.Add("4")
             MySelect2.Items.Add("1")
             MySelect2.Items.Add("2")
             MySelect2.Items.Add("3")
             MySelect2.Items.Add("4")
         End If
     End Sub               
     
     Sub btnTable_Click(sender As Object,e As EventArgs)
         Dim i,j,NumOfRow,NmOfCell As Integer
         Dim MyTableRow,MyTableCell As Object
         NumOfRow =(MySelect1.Value)
         NmOfCell =(MySelect2.Value)
         for j=1 to NumOfRow
             MyTableRow =new HtmlTableRow()
             for i=1 to NmOfCell
                 MyTableCell=new HtmlTableCell()
                 MyTableCell.InnerHtml=("第"+j+"行,第"+i+"列")
                 MyTableRow.Cells.Add(MyTableCell)
             Next
             MyHtmlTable1.Rows.Add(MyTableRow)
         Next
     End Sub
</script>
<html>
<head>
    <title>HTML中Table控件的使用</title>
</head>
<body id ="body1" runat ="server">
    <form id="form1" runat =server>
        <table id ="MyHtmlTable1" runat ="server" CellPadding="4" CellSpacing ="1" Border="1" BorderColor="Blue"/><P>
        </table>
        <b>行数:</b>
        <select id ="MySelect1" runat = "server"/><br>
        <b>列数:</b>
        <select id ="MySelect2" runat = "server"/>
        <input type ="submit" value ="生成新表格" OnServerClick="btnTable_Click" runat ="server">
    </form>
</body>
</html>


程序代码:
<SCRIPT language=vb runat="server">

     Sub Page_Load(sender As Object,e As EventArgs )
         If not Page.IsPostBack then 
             MySelect1.Items.Add("1")
             MySelect1.Items.Add("2")
             MySelect1.Items.Add("3")
             MySelect1.Items.Add("4")
             MySelect2.Items.Add("1")
             MySelect2.Items.Add("2")
             MySelect2.Items.Add("3")
             MySelect2.Items.Add("4")
         End If
     End Sub               
     
     Sub btnTable_Click(sender As Object,e As EventArgs)
         Dim i,j,NumOfRow,NmOfCell As Integer
         Dim MyTableRow,MyTableCell As Object
         NumOfRow =(MySelect1.Value)
         NmOfCell =(MySelect2.Value)
         for j=1 to NumOfRow
             MyTableRow =new HtmlTableRow()
             for i=1 to NmOfCell
                 MyTableCell=new HtmlTableCell()
                 MyTableCell.InnerHtml=("第"+j+"行,第"+i+"列")
                 MyTableRow.Cells.Add(MyTableCell)
             Next
             MyHtmlTable1.Rows.Add(MyTableRow)
         Next
     End Sub

</script>

搜索更多相关主题的帖子: Add 代码 Sub 
2005-01-08 10:35
luohaifeng
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-1-8
得分:0 
    明白了,谢谢版主!
2005-01-08 17:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-10936-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.177211 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved