日期:2014-05-17 浏览次数:20898 次
ID = split(trim(request("ID")),",") Num = len(request("ID"))-len(ChaStr(request("ID"),",","")) for i = 0 to num sql = "delete * from[Table] where ([ID] in("&ID(i)&"))" On Error Resume Next conn.execute(sql) If Err Then '错误检测 Err.Clear response.write "记录["&ID(i)&"]删除失败!<br>" else response.write "记录["&ID(i)&"]删除成功!<br>" End If next
------解决方案--------------------
补充第二行ChaStr换成replace
------解决方案--------------------
上面2位兄弟提供的可以实现!
------解决方案--------------------
全选功能,如所有选项checkbox控件为<input id="ID" name="ID" type="checkbox" value="<%=rec("ID")%>">
<script language="JavaScript"> var g_blRdoAllCheck=false; function btnCheckAll_Click(form,objBtn,blRdoAllChecked) { g_blRdoAllCheck=allRdoIDChecked(form,blRdoAllChecked,"ID"); if(g_blRdoAllCheck) objBtn.value="取消"; else objBtn.value="全选"; } function blRdoChecked(form,sDspStr) { var bl=false; items=form.all.tags("input"); for (i=0;i<items.length;i++) if (items(i).type=="checkbox"&&items(i).name.toUpperCase()==sDspStr.toUpperCase()) if (items(i).checked)bl=true; // return bl; } function allRdoIDChecked(form,blRadioAllChecked,sDspStr) { items=form.all.tags("input"); if(blRadioAllChecked) { for (i=0;i<items.length;i++) if (items(i).type=="checkbox"&&items(i).name.toUpperCase()==sDspStr.toUpperCase()) items(i).checked=false; return false; } else { for (i=0;i<items.length;i++) if (items(i).type=="checkbox"&&items(i).name.toUpperCase()==sDspStr.toUpperCase()) items(i).checked=true; return true; } } function btnRecDel_Click(form, act) { if(confirm("您确定要删除选中的记录吗?")) { if(blRdoChecked(form,"ID")) { form.action="ArtsDel.asp?typeid=<%=TypeID%>&Mtype=del&catid=<%=CatID%>"; form.submit(); } else { alert("您至少要选中一条记录,才能进行删除操作"); } } } </script>
------解决方案--------------------
调用:
<input type="button" class="btn" value="全选" id=btnCheckAll onClick="javascript:btnCheckAll_Click(this.form,this,g_blRdoAllCheck)&q