在用checkbox删除记录的程序中出错,请帮帮忙,找出错误
function del()
{
var count=false,sum=0,str;
if (checkbox.length>0)
//{
for (i=0;i<form1.checkbox.length;i++)
{
if (form1.checkbox[i].checked)
{
count=true;
sum=sum+1;
}
}
if(sum>0)
{
str="你确定要删除这"+sum+"个用户吗?";
}
else
{
str="你确定要删除该用户吗?";
}
if (count)
{
if (confirm(str))
{
document.form1.action="userdel.do";
document.form1.submit();
}
return true;
}
else
alert("请选择用户!");
return false;
}
else{
if(form1.checkbox.checked)
{
confirm("你确定要删除最后一个用户吗?");
document.form1.action="userdel.do";
document.form1.submit();
}
else alert("请选择用户!");
return false;
}