你的位置:首页 > 软件开发 > ASP > asp批量删除

asp批量删除

发布时间:2008-04-06 16:01:00
<%Dim ActionAction=Trim(Request("Action"))id=Trim(Request("id"))IF Action="delall" Then Conn.Execute("Delete From 通讯录 Where id In ("&id&")

<%
Dim Action
Action=Trim(Request("Action"))
id=Trim(Request("id"))
IF Action="delall" Then
   Conn.Execute("Delete From 通讯录 Where id In ("&id&")")
  Response.Write "<script language='javascript'>alert('删除成功!');location='index.asp';</script>"
  Response.End()
End If
%>
<script language="javascript">
function CheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
  {
    var e = form.elements[i];
    if (e.Name != "chkAll"&&e.disabled==false)
    e.checked = form.chkAll.checked;
   }
}
function count_checked_items()
{
  var number_checked=0;
  var box_count=document.form1.id.length;
  if ( box_count==null )
  {
  if ( document.form1.id.checked==true )
   {
  number_checked=1;}
  else {
  number_checked=0;}
  }
  else {
  for ( var i=0; i < (box_count); i++ ) {
  if ( document.form1.id[i].checked==true ) {
  number_checked++;}}}
  return number_checked;
}
 function SubmitForm()
 {
      if (count_checked_items()>0){          
          if(confirm("您真的要删除所选的吗?")){          
          document.form1.action="?Action=delall";
          document.form1.submit();
          }
      }
      else
          alert('请您先选择要删除的!');
          return false;      
 }
</script>

在表单里加入

 <input name="id" type="checkbox" id="id" value="<%=rs("id")%>" />

最后加入
<input name="chkAll" type="checkbox" id="chkAll2" onClick="CheckAll(form1)" value="checkbox">
全选&nbsp; <input name="del" type="button"  id="del" onClick="return SubmitForm();" value="全部删除">

原标题:asp批量删除

关键词:ASP

ASP
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。