日期:2014-05-17  浏览次数:20555 次

全选按钮无法达到全选要求,这是怎么回事
产品表格是通过JSON返回的数据按照如下设计好的模板生成。
var proTable = "";
  proTable = proTable + "<table width=100% border=0 cellpadding=0 cellspacing=0>";
  proTable = proTable + "<form action='/Users/AddProHouse'method='post'><tr><td height=25 rowspan=2 align=center class=border_bottom><input name=all id=all type=checkbox />全选</td>";
  proTable = proTable + "<td height=25 rowspan=2 align=center class=border_bottom>产品名称</td>";
  proTable = proTable + "<td height=25 rowspan=2 align=center class=border_bottom>产品代号</td>";
  proTable = proTable + "<td height=25 rowspan=2 align=center class=border_bottom>品种</td>";
  proTable = proTable + "<td height=25 rowspan=2 align=center class=border_bottom>品牌</td>";
  proTable = proTable + "<td height=25 colspan=3 align=center class='border_bottom border_left'>品质/价格</td>";
  proTable = proTable + "</tr>";
  proTable = proTable + "<tr>";
  proTable = proTable + "<td height=25 align=center class='border_bottom border_left'>原厂</td>";
  proTable = proTable + "<td height=25 align=center class='border_bottom'>配套</td>";
  proTable = proTable + "<td height=25 align=center class='border_bottom'>副厂</td>";
  proTable = proTable + "</tr>";
  var i;
  for (i = 0; i < data.length - 1; i++) {
  proTable = proTable + "<tr>"
  proTable = proTable + "<td align=center class=border_bottom>><input name=p_list id=p_list type=checkbox value='" + $.trim(data[i].cpxh) + "'/></td>";
  proTable = proTable + "<td align=center class=border_bottom>" +$.trim(data[i].cpxh)+ $.trim(data[i].cpmc) + "</td>";
  proTable = proTable + "<td align=center class=border_bottom>" + $.trim(data[i].cpdh) + "</td>";
  proTable = proTable + "<td align=center class=border_bottom>" + $.trim(data[i].pzmc) + "</td>";
  proTable = proTable + "<td align=center class=border_bottom>" + $.trim(data[i].ppmc) + "</td>";
  proTable = proTable + "<td align=center class='border_bottom border_left'>" + $.trim(data[i].ycxj) + "</td>";
  proTable = proTable + "<td align=center class=border_bottom>" + $.trim(data[i].ptxj) + "</td>";
  proTable = proTable + "<td align=center class=border_bottom>" + $.trim(data[i].fcxj) + "</td>";
  proTable = proTable + "</tr>";
  }
  proTable = proTable + "</form></table>";
  $("#ProListTable").html(proTable)
点击全选代码
  $(function () {
  $("#all").click(function () {
  $("input[name='p_list']").attr("checked", $(this).attr("checked"));
  });
  $(