$(document).ready(function() {
    $("input[name='btn']").click(function() {
        var ck = $(" input:checked").parent().parent();
        var elb_id = "";
        var bookname = "";
        var publisher = "";
        var jh = "";
        var qh = "";
        var content = "";
        $(ck).each(function() {
            if ($(this).children("td:nth-child(3)").text() != "") {
                elb_id += $(this).children("td:nth-child(3)").text() + ",";
            }
        });
        if ($(this).children("tr  td:first-child").eq(4).text() != "") {
            bookname = $(this).children(" tr  td:first-child").eq(4).text();
        }
        alert(bookname);
        if ($(ck).children("tr td:first-child").eq(8).text() != "") {
            publisher = $(ck).children("tr td:first-child").eq(8).text();
        }
         //alert(publisher);
        if ($(ck).children("tr td:first-child").eq(9).text() != "") {
            content = $(ck).children("tr td:first-child").eq(9).text();
        }
        // alert(content);
        $(ck).each(function() {
            if ($(this).children("td:nth-child(7)").text != "") {
                qh += $(this).children("td:nth-child(7)").text() + ",";
            }
        });
       // alert(qh);
        $(ck).each(function() {
            if ($(this).children("td:nth-child(8)").text() != "") {
                jh += $(this).children("td:nth-child(8)").text() + ",";
            }
        });
        //alert(jh);
    });
});小弟分少,请各位大侠原谅

解决方案 »

  1.   

    额,忘了说问题所在了,问题就是,为什么我的不到checkbox的属性为checked某一行中的值,比如bookname,publisher,content,而elb_id,qh能得到?
      

  2.   


    ck.each(function() {//ck是jquery对象不用转换的$(ck)
      if ($(this).children("td:nth-child(8)").text() != "") {
      jh += $(this).children("td:nth-child(8)").text() + ",";
      }
      });orck.each(function() {//ck是jquery对象不用转换的$(ck)
      if ($(this).find("td:eq(8)").text() != "") {
      jh += $(this).find("td:eq(8)").text() + ",";
      }
      });
      

  3.   

    ck.each(function() {//ck是jquery对象不用转换的$(ck)
      if ($(this).children("td:nth-child(8)").text() != "") {
      jh += $(this).children("td:nth-child(8)").text() + ",";
      }
      });orck.each(function() {//ck是jquery对象不用转换的$(ck)
      if ($(this).find("td:eq(8)").text() != "") {
      jh += $(this).find("td:eq(8)").text() + ",";
      }
      });-----------------------------------------------------
    用nth-child 它把表格中所有选中的child(8)都得到了,而我要做的是,不管选中多少我就只要表格中第一行为child(8)那一列的数据
      

  4.   


    ck.parent().find(tr:eq(0)).find("td:eq(8)").text();
    or
    ck.parent().find(tr:eq(0)).children("td:nth-child(8)").text();