<div class="codetitle"> <span><a style="CURSOR: pointer" data="23948" class="copybut" id="copybut23948" onclick="doCopy('code23948')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code23948"> <br><input type="checkbox" id="checkAll" value="1">全选/全部不选 <br><input type="checkbox" name="items" value="1">1 <br><input type="checkbox" name="items" value="2">2 <br><input type="checkbox" name="items" value="3">3 <br><input type="checkbox" name="items" value="4">4 <br><input type="checkbox" name="items" value="5"> <br><input type="button" onclick="show()" value="提示选择的"> <br><script> <br>$("#chekcAll").click(function(){ <br>if(this.checked){ <br>$("input[name=items]").attr("checked","checked"); <br>} <br>else{ <br>$("input[name=items]").attr("checked",null); <br>} <br>}) <br>function show(){ <br>var strIds=new Array();//声明一个存放id的数组 <br>$("input[name=items]").each(function (i,d){ <br>if (d.checked) { <br>strIds.push(d.value); <br>} <br>}) <br>if(strIds.length<1) <BR>alert("您没有选中项!"); <BR>else{ <BR>var ids=strIds.join(","); <BR>alert("你选中的字符串有:" ids); <BR>} <br><br><BR>} <br><br></script> <br> </div>