//获取所有选中的CheckBox的id function getCheckBox() { var spCodesTemp = ""; $("input:checkbox[name=IsOnSell]:checked'").each(function(i) { if (0 == i) { spCodesTemp = $(this).attr("id"); } else { spCodesTemp += ("," + $(this).attr("id")); } }); alert(spCodesTemp); }