function check_all(f)
{
    var chk = document.getElementsByName("chk[]");

    for (i=0; i<chk.length; i++)
        chk[i].checked = f.chkall.checked;
}

function btn_check(f, act)
{
    if (act == "update") // 修改
    { 
        f.action = list_update_php;
        str = "修改";
    } 
    else if (act == "delete") // 选择删除
    { 
        f.action = list_delete_php;
        str = "删除";
    } 
    else
        return;

    var chk = document.getElementsByName("chk[]");
    var bchk = false;

    for (i=0; i<chk.length; i++)
    {
        if (chk[i].checked)
            bchk = true;
    }

    if (!bchk) 
    {
        alert("请选择需要"+str+"内容");
        return;
    }

    if (act == "delete")
    {
        if (!confirm("确定删除选择的内容吗？"))
            return;
    }

    f.submit();
}
