jquery实现checkedbox全选和不选
<script type="text/javascript">
/*全选、全不选*/
$(document).ready(function(){
$("#checkedAll").click(function () {
$("input[name='couponType.ids']").attr("checked",this.checked);
});
var $subBox=$("input[name='couponType.ids']");
$subBox.click(function () {
$("#checkedAll").attr("checked",$subBox.length==$("input[name='couponType.ids']:checked").length ? true : false);
});
});
</script>
<body>
<div class="fitem" style="margin-top:15px;width: 500px; padding-left: 40px;">
<label >类型:</label>
<input type="checkbox" name="checkedAll" id="checkedAll" />全选
<s:iterator value="itemList" var="m" >
<input type="checkbox" name="couponType.ids" value="<s:property value='#m.itemCode' />"><s:property value='#m.itemName' />
</s:iterator>
</div>
</body>