复选框的问题
function sp_all()
{
sp_str="";
for(i=0;i<document.all("file_select[]").length;i++)
{
el=document.all("file_select[]").item(i);
if(el.checked)
{
val=el.value;
sp_str+=val + ",";
}
}
if(i==0)
{
el=document.all("file_select[]").item(i);
if(el.checked)
{
val=el.value;
sp_str+=val + ",";
}
}
if(sp_str=="")
{
alert("请至少选择其中一个。");
document.form1.reset();
return;
} msg='确认要批准已选中的选项吗?';
if(window.confirm(msg))
{
url="update_all.php?sp_str="+ sp_str +"& WEIGHT=<?
echo $WEIGHT;
?> ";
window.location=url;
}
}
function check_all()
{
for(i=0;i<document.all("file_select[]").length;i++)
{
if(document.all("allbox").checked)
document.all("file_select[]").item(i).checked=true;
else
document.all("file_select[]").item(i).checked=false;
}
if(i==0)
{
if(document.all("allbox").checked)
document.all("file_select").checked=true;
else
document.all("file_select[]").checked=false;
}
}
function check_one(el)
{
if(!el.checked)
document.all("allbox").checked=false;
}
不知道为什么,只有一条记录的时候,选中时不知道为什么出错,帮帮忙解决一下