日期:2014-05-16 浏览次数:20388 次
<div id="dvABC">
<table class="l_height_30 gridcontent" width="100%" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td width="50" class="bg_thead center">序号</td>
<td class="bg_thead pl_10">内容</td>
</tr>
</thead>
<tbody>
<tr>
<td width="50" class="bg_thead center">1</td>
<td class="bg_thead pl_10">aaaaa</td>
</tr>
<tr>
<td width="50" class="bg_thead center">2</td>
<td class="bg_thead pl_10">bbbbb</td>
</tr>
<tr>
<td width="50" class="bg_thead center">3</td>
<td class="bg_thead pl_10">ccccc</td>
</tr>
</tbody>
</table>
</div>
$("#dvABC tr").each( function(){
alert( $(this).text() )
} )
var tr = $("#dvABC table tr");
$("#dvABC table tr").each(function() {
// tr循环
// 如果要TD循环,可以像下面这样写
$(this).find("td").each(function() {
// td逻辑
});
// 如果想获取某一个td的,可以这样写
var td = $(this).find("td:eq(" + tdIdx + ")");
// 例如获取第一个单元格$(this).find("td:eq(0)");
});