aspx代码
<asp:CheckBoxList runat="server" ID="cbWoods" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="cbPr">
<asp:ListItem Value="1" wValue="1">1</asp:ListItem>
<asp:ListItem Value="3" wValue="3">3</asp:ListItem>
<asp:ListItem Value="5" wValue="5">5</asp:ListItem>
<asp:ListItem Value="7" wValue="7">7</asp:ListItem>
<asp:ListItem Value="9" wValue="9">9</asp:ListItem>
</asp:CheckBoxList>
js代码
var woods = function () {
var str = "";
$("input[id^=cbWoods]").each(function () {
if (this.checked) {
if (str != "") {
str += ",";
}
str += $(this).parent("span").attr("wValue");
}
});
return str;
}