日期:2014-05-17 浏览次数:20780 次
<asp:DataList ID="dlList" runat="server" RepeatColumns="3" RepeatDirection="Horizontal">
        <ItemTemplate>
            <table>
                <tr>
                    <td><%# Eval("strTitle") %></td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:DataList>
------解决方案--------------------
js可以这样var arr=document.getElementsByTagName("td");
for(var i=0;i<var.length;i++){
document.write(arr[i].innerText);
}
.net的话就需要将table属性设置runat="server"然后int rowCount=this.tab.Rows.Count;
int cellCount=this.tab.rows[i].Cells.Count;
如何获取单元格中的InnerText就可以了
------解决方案--------------------
<table cellpadding="0" border="1" cellspacing="0">
            <%
                for (int i = 1; i <= 10; i++)
                {
                    if (i % 3 == 1)
                    {
            %>
                        <tr>
            <%
                    }
            %>
                            <td>
                              dd
                            </td>
            <%
                   if (i == 10)
                   {
                      for (int j = 0; j < 3 - 10 % 3; j++)
                      {
            %>
                           <td>
                              
                           </td>
            <%
                      }
                    }
            %>
            <%
                   if ((i % 3 == 0) || (i == 10))
                   {
            %>
                       </tr>
            <%
                   }
                } 
            %>
        </table>