简单列表页全选删除
程序员文章站
2022-06-13 14:18:34
...
三步搞定全选删除
function unselectall(){
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form){
for (var i=0;i
var e = form.elements[i];
if (e.Name != 'chkAll'&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}
html
//action中调用
$user=M('User');
$base=A('Base');
$user->deleteall($staff);
//全选删除函数
public function deleteall($mouldel){
@extract($_POST);
$counts=count($id);
for($i=0;$i
{
$mouldel->where('id="'.$id[$i].'"')->delete();
}
if($counts)
{
$this->success("删除成功");
}
else
{
$this->error("删除失败");
}
}
模板中js部分function unselectall(){
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form){
for (var i=0;i
if (e.Name != 'chkAll'&&e.disabled==false)
e.checked = form.chkAll.checked;
}
}
html
AD:真正免费,域名+虚机+企业邮箱=0元