Jquery 获得table的行数,并输出单元格的内容

    <script language="javascript" type="text/javascript">
        $(function() {
            $("#txtInput").attr("value", "90");
            var v_temp = $("#lblMessage").text();
            //alert(v_temp);
            $("#txtInput01").attr("value", v_temp);
            $("#div1").removeClass("div1");
            $("#div1").addClass("divtest");
            var flog = $("#div1").hasClass("divtest");
            $("#div1").html("<input type='button' id='id123' style='width:100px; height:150px'>");
            var t01 = $("#table01 tr").length;
            alert(t01);
            $("#table01").find("td").each(function(i) {
                var t = $(this).text();
                alert(t);
            })


        });

 <form id="form1" runat="server">
    <div>
    <input type="text" id="txtInput" runat="server" style=" font:" />
    <br/>
    <asp:Label ID="lblMessage" Text="我在测试"  runat="server"></asp:Label>
    <br/>
    <input type="text" id="txtInput01" runat="server"  />
        <br />
        <asp:TextBox ID="TextBox1" runat="server" Width="156px"></asp:TextBox>
       <input type="button" onclick="createXMLHttpRequest()" />
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    </div>
     <table id="table01" border="1px"><tr>
    <td>11</td><td>11</td></tr>
    <tr><td>22</td><td>22</td></tr>
    <tr><td>33</td><td>33</td></tr>
    <tr><td>44</td><td>44</td></tr>
    <tr><td>55</td><td>55</td></tr></table>
    <div id="div1" class="div1">
  
    </div>
    </form>

posted @ 2011-10-18 10:47  居后不争  阅读(42074)  评论(1编辑  收藏  举报