代码 应该可以加个form表单,提交的服务器的数据input的多选框value值是使用“,”隔开的字符串 <script type="text/javascript"> function ChooseAll(sel, check) { var objtb = document.getElementById(sel); var num = objtb.getElementsByTagName("input"); var check = document.getElementById(check); for (i = 0; i < num.length-1; i++) { if (num[i].tagName == "INPUT") { alert(num[i].value); if (check.checked == true) { num[i].checked = true; } else { num[i].checked = false; } } } } </script> <table id="tabList" width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#C7CDCB" > <tr style="color:#897D4D; font-weight:bold;"> <td width="1%" height="20" align="center" valign="middle" bgcolor="#FFF2CB" scope="row">选择</td> <td width="10%" height="20" align="center" valign="middle" bgcolor="#FFF2CB" scope="row">项目名称</td> <td width="10%" height="20" align="center" valign="middle" bgcolor="#FFF2CB">申请单位</td> <td width="10%" height="20" align="center" valign="middle" bgcolor="#FFF2CB">申请时间</td> <td width="10%" height="20" align="center" valign="middle" bgcolor="#FFF2CB">状态</td> <td width="15%" height="20" align="center" valign="middle" bgcolor="#FFF2CB">操作</td> </tr> <tr> <td bgcolor="#FFF2CB"> <input id="chkChoose" name="chkChoose" type="checkbox" value='11' /> </td> <td align="center" valign="middle" bgcolor="#FFFFFF">qq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF"> </td> </tr> <tr> <td bgcolor="#FFF2CB"> <input id="chkChoose" name="chkChoose" type="checkbox" value='22' /> </td> <td align="center" valign="middle" bgcolor="#FFFFFF">qq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF"> </td> </tr> <tr> <td bgcolor="#FFF2CB"> <input id="chkChoose" name="chkChoose" type="checkbox" value='33' /> </td> <td align="center" valign="middle" bgcolor="#FFFFFF">qq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF"> </td> </tr> <tr> <td bgcolor="#FFF2CB"> <input id="chkChoose" name="chkChoose" type="checkbox" value='44' /> </td> <td align="center" valign="middle" bgcolor="#FFFFFF">qq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF">qqqqqq</td> <td align="center" valign="middle" bgcolor="#FFFFFF"> </td> </tr> <tr> <td colspan="8" valign="middle" bgcolor="#FFFFFF"> <input id="chkChooseAll" type="checkbox" onclick="ChooseAll('tabList','chkChooseAll')" />全选 <button type="button" class="button negative" OnClientClick="return confirm('确定要删除吗?')" > 删除</button> </td> </tr> </table>
评论回复