在onclick中获取动态表格单元格的值

时间:2012-06-01 11:16:55

标签: jquery html-table

如果我在代码中执行以下jQuery:

if (data.PCompany.length > 0) {                        
$.each(data.PCompany, function (i, subEntity) {   
html.push('<tr><td id="row"><a style="color:green;text-decoration:underline;cursor:pointer;" id="link">' + subEntity.Name + '</a></td>
<td id="deem">' + subEntity.Deemed + '</td></tr>'); 
        });
        }
     if (data.CCompany.length > 0) {
    $.each(data.CCompany, function (i, subEntity) {
    html.push('<tr><td nowrap="nowrap">' + subEntity.Name + '</td><td id="deem1" >'
    + subEntity.Deemed +'</td><td>'+ subEntity.Effect shares+ '</td></tr>');
      });            
      }

这将产生两个表,每个表中有许多列。 现在,我想在我的subEntity.Deemed表中的一列中单击两个表中的pcompany列的值。 结果如下:

`Pcomapny table`
 <td id="deem">1<td> <td id="deem">2<td>
 Ccompany
 <td id="deem1">3<td> <td id="deem1">4<td> <td id="deem1">5<td> <td id="deem1">6<td>


On first row  onclick of Pcompany table i want to get 1 and 3,
   1 and 4, 1 and 5, 1 and 6
on second row onclick want to get 2 and 3 , 2 and 4, 2 and 5 etc...

0 个答案:

没有答案