<script type='text/javascript'> //全选 function checkAllChkBox(boolvalue,formid) { var name = formid+'[]'; var ochkForm = document.getElementById(formid); var ochkBoxes = document.getElementsByName(name); try { if(ochkBoxes.length>0) { for(var i=0;i<ochkBoxes.length;i++) { ochkBoxes[i].checked = boolvalue; } } else ochkBoxes.checked = boolvalue; } catch (e) {} } //获取选取值 function getchkbox(fid) { var name = fid+'[]'; var ochkForm = document.getElementById(fid); var ochkBoxes = ochkForm[name]; if (ochkBoxes == undefined) { bangding(); return; } var strval = ""; var biaoyang = jQuery('#biaoyang').val(); var iLen = ochkBoxes.length; var iLenval = 0; for(var i=0;i<iLen;i++) { if (ochkBoxes[i].checked == true) { strval = strval+'&'+ochkBoxes[i].value; iLenval++; } } if (iLenval > 0) { alert("你将表扬:"+strval+":"+biaoyang); } else { alert("您未选择该分组下任何用户"); } } </script>?<div class="quanxuan"><input name="" type="checkbox" onclick="checkAllChkBox(this.checked,'check1')" value=""/> 全选</div>
<form name="check1" id="check1"> <div class="hiuyuan clearfix"> <div class="imgDiv"> <a href="#"><img src="/images/adorn/b_00.gif" width="50" height="50" alt="" /></a><input type="checkbox" name="check1[]" value='1287464960' class="input"/><a href="#">张三</a> </div> <div class="imgDiv"> <a href="#"><img src="/images/adorn/b_00.gif" width="50" height="50" alt="" /></a><input type="checkbox" name="check1[]" value="1287464960" class="input"/><a href="#">跟对跟对方给</a> </div> <div class="imgDiv"> <a href="#"><img src="/images/adorn/b_00.gif" width="50" height="50" alt="" /></a><input type="checkbox" name="check1[]" value="1287464960" class="input"/><a href="#">跟跟方给</a> </div> <div class="imgDiv"> <a href="#"><img src="/images/adorn/b_00.gif" width="50" height="50" alt="" /></a><input type="checkbox" name="check1[]" value="1287464960" class="input"/><a href="#">李四</a></a> </div> <div class="imgDiv"> <a href="#"><img src="/images/adorn/b_00.gif" width="50" height="50" alt="" /></a><input type="checkbox" name="check1[]" value="1287464960" class="input"/><a href="#">跟对跟对方给</a> </div> </div> </form>?
1 楼
argont
2011-01-13
checkbox有时候是分组的,这样实现有点笼统了。