<SCRIPT language=javascript>
function isSelect() {
flag=false;
for (i=0;i<document.form.elements.length;i++)
if(document.form.elements[i].checked) flag=true;
        if (flag) 
        document.form.submit();
       else
        alert("请选择数据!"); 
}
</SCRIPT>

解决方案 »

  1.   

    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <script>
    function selAll(oForm)
    {
    var fChecked = oForm.chkall.checked;
    var nLen = oForm.id.length;
    if (typeof nLen== "undefined") //表单中只有一个复选框的情况
    oForm.id.checked = fChecked;
    else
    for(i=0;i<nLen;i++)
    {
    oForm.id[i].checked = fChecked;
    }
    }function delAll(oForm)
    {
    var nLen,fSel;
    fSel=false;
    nLen = oForm.id.length;
    if (typeof nLen== "undefined")
    fSel = oForm.id.checked;
    else
    for(i=0;i<nLen;i++)
    {
    if (oForm.id[i].checked==true)
    {
    fSel=true;
    break;
    }
    }
    if (fSel) //至少选中了一个复选框
    {
    if (confirm("确实要从数据库中删除这些会员吗?"))
    {
    oForm.submit();
    }
    return;
    }
    }
    </script>
    </head><body>
    <form action="member_manage.asp?action=del" method="post" name="memberlst">
    <input name="id" type="checkbox" id="id" value="1">
    <input name="id" type="checkbox" id="id" value="2">
    <input name="chkall" type="checkbox" id="chkall" onclick="selAll(this.form)">
    全选/全不选
    <input name="Submit" type="button" class="button" onclick="delAll(this.form)" value="删除">
    </form></body>
    </html>