<script type="text/javascript" language="javascript">
function selectBox(selectType){
var checkboxis = document.getElementsByName("id[]");
if(selectType == "reverse"){
for (var i=; i<checkboxis.length; i++){
//alert(checkboxis[i].checked);
checkboxis[i].checked = !checkboxis[i].checked;
}
}
else if(selectType == "all")
{
for (var i=; i<checkboxis.length; i++){
//alert(checkboxis[i].checked);
checkboxis[i].checked = true;
}
}
}
</script>

表单部分

<form id="form2" name="form2" method="post" action="del_product.php" onsubmit="return checkF(this)">
<table width="100%" border="" cellspacing="" cellpadding="">
<tr>
<td width="6%" height="" align="center" style="border-bottom:1px #D7EBFF dotted;">ID</td>
<td width="85%" align="center" style="border-bottom:1px #D7EBFF dotted;">标题</td>
<td width="9%" align="center" style="border-bottom:1px #D7EBFF dotted;">操作</td>
</tr>
<tr bgcolor="#ffffff" onmouseover="this.style.background='#EEFAFF'; " onmouseout ="this.style.background='#ffffff'; this.style.bordercolor=''">
<td height="" align="center" style="border-bottom:1px #D7EBFF solid;">
<label>
<input type="checkbox" name="id[]" value="<?php echo $rs['id'];?>" style="background:none; border:none;" /><?php echo $rs['id'];?>
</label>
</td>
<td align="left" style="border-bottom:1px #D7EBFF solid;"><?php echo $rs['title']; ?></td>
<td align="center" style="border-bottom:1px #D7EBFF solid;"><a href="quality_edit.php?id=<?php echo $rs['id']; ?>&pg=<?php echo $PB_page; ?>">编辑</a> | <a href="?action=del&id=<?php echo $rs['id'];?>&pg=<?php echo $PB_page; ?>" onclick="return confirm('确定删除?')">删除</a></td>
</tr>
<?php
}
?>
<tr bgcolor="#EEFAFF">
<td height="" colspan="" align="left" style="border-bottom:1px #D7EBFF solid;">
<div style="padding-left:20px;"><input type="button" value="全选" style="background:url(images/cheall.jpg) no-repeat; width:60px; height:23px; border:none;" onClick="selectBox('all')"/>
<input type="button" value="反选" style="background:url(images/cheall.jpg) no-repeat; width:60px; height:23px; border:none;" onClick="selectBox('reverse')"/>
<input type="submit" name="btnSave" style="background:url(images/cheall.jpg) no-repeat; width:60px; height:23px; border:none;" value="删除"/> </div>
</td>
</tr> </table>
</form>

del_product.php  处理文件

<?php
include('checkadmin.php');
header('Content-Type: text/html; charset=utf-8');
if($_POST['btnSave']){ if(empty($_POST['id'])){
echo"<script>alert('必须选择一个产品,才可以删除!');history.back(-1);</script>";
exit;
}else{
/*如果要获取全部数值则使用下面代码*/ $id= implode(",",$_POST['id']);
$str="DELETE FROM `product` where id in ($id)";
mysql_query($str);
echo "<script>alert('删除成功!');window.location.href='product_list.php';</script>";
}
}
?>

简单批量删除

<form id="form2" name="form2" method="post" action="del_product.php" onsubmit="return checkF(this)">
<label>
<input type="checkbox" name="id[]" value="<?php echo $rs['id'];?>" style="background:none; border:none;" />
</label>
<div style="padding-left:20px;"><input type="button" value="全选" style="background:url(images/cheall.jpg) no-repeat; width:60px; height:23px; border:none;" onClick="selectBox('all')"/>
<input type="button" value="反选" style="background:url(images/cheall.jpg) no-repeat; width:60px; height:23px; border:none;" onClick="selectBox('reverse')"/>
<input type="submit" name="btnSave" style="background:url(images/cheall.jpg) no-repeat; width:60px; height:23px; border:none;" value="删除"/> </div> </form> JS
[javascript] view plaincopy
<script type="text/javascript" language="javascript">
function selectBox(selectType){
var checkboxis = document.getElementsByName("id[]");
if(selectType == "reverse"){
for (var i=; i<checkboxis.length; i++){
//alert(checkboxis[i].checked);
checkboxis[i].checked = !checkboxis[i].checked;
}
}
else if(selectType == "all")
{
for (var i=; i<checkboxis.length; i++){
//alert(checkboxis[i].checked);
checkboxis[i].checked = true;
}
}
}
</script> del_product.php
[php] view plaincopy
<?php
include('checkadmin.php');
header('Content-Type: text/html; charset=utf-8');
if($_POST['btnSave']){ if(empty($_POST['id'])){
echo"<script>alert('必须选择一个产品,才可以删除!');history.back(-1);</script>";
exit;
}else{
/*如果要获取全部数值则使用下面代码*/ $id= implode(",",$_POST['id']);
$str="DELETE FROM `product` where id in ($id)";
mysql_query($str);
echo "<script>alert('删除成功!');window.location.href='product_list.php';</script>";
}
}
?>

asp批量删除

<%@LANGUAGE="VBSCRIPT" CODEPAGE=""%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="inc_global.asp"-->
<%
current_nav = "b_6"
If reqf("submit") = "执行操作" Then
Call nullback(reqf("id"), "请至少选中一项!")
If reqf("r_method") = Then
Call infoback("请选择要执行的操作!")
ElseIf reqf("r_method") = Then
sql = "delete from cms_resume where id in ("&reqf("id")&")"
End If
conn.Execute(sql)
Call infohref ("执行成功!", "cms_resume.asp")
End If
%>
<title>管理后台-管理应聘</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function check_all(obj,cName)
{
var checkboxs = document.getElementsByName(cName);
for(var i=;i<checkboxs.length;i++){checkboxs[i].checked = obj.checked;}
}
</script>
</head>
<body>
<!--#include file="inc_top.asp"-->
<div id="content_main">
<div id="content_title"> </div>
<div id="content_body">
<!--#include file="inc_left.asp"-->
<div id="right">
<div class="right_title">
<h2>管理应聘</h2>
</div>
<div class="right_body">
<table class="common_table">
<form method="post">
<tr>
<th width="">选</th>
<th width="">应聘日期</th>
<th>应聘职位</th>
<th width="">应聘人</th>
<th width="">电话</th>
<th width="">详情</th>
</tr>
<!--循环开始-->
<%
sql = "select * from cms_resume order by r_date desc"
page_size =
pager = pageturner_handle(sql, "id", page_size)
Set rs = pager()
If rs.EOF Then
echo "暂无订单信息!"
End If
Do While Not rs.EOF %> <!--循环结束-->
<tr align="center">
<td>
<input name="ID" type="checkbox" id="ID" value="<%=rs("id")%>" />
</td>
<td><%=rs("r_date")%></td>
<td><%=rs("r_name")%></td>
<td><%=rs("r_username")%></td>
<td><%=rs("r_tel")%></td>
<td><a href="cms_resume_detail.asp?id=<%=rs("id")%>">详情</a></td>
</tr>
<%
rs.movenext
Loop
rs.Close
Set rs = Nothing
%>
<tr align="center">
<td>
<input name="ID" type="checkbox" onclick="check_all(this,'ID')" />
</td>
<td colspan="" align="left">
<select class="form_select" name="r_method">
<option value="">选择操作</option>
<option value="">删除应聘</option>
</select>
<input type="submit" name="submit" value="执行操作" />
</td>
</tr>
</form>
</table>
<%=pageturner_show(pager(),pager(),pager(),page_size,)%> </div>
<div class="right_bottom"></div>
</div>
<div class="clear"></div>
</div>
<div id="content_bottom"></div>
</div>
<!--#include file="inc_bottom.asp"-->
</body>
</html>

PHP全选择删除功能的更多相关文章

  1. vue实战记录(五)- vue实现购物车功能之商品总金额计算和单选全选删除功能

    vue实战,一步步实现vue购物车功能的过程记录,课程与素材来自慕课网,自己搭建了express本地服务器来请求数据 作者:狐狸家的鱼 本文链接:vue实战-实现购物车功能(五) GitHub:sue ...

  2. 当你的layui表格要做全选+删除功能【兼容ie8】

    <!-- 全选 --> <div class="choose"> <input type="checkbox" id=" ...

  3. input file样式修改,图片预览删除功能

    本篇对input file进行了修改,改成自己需要的样式,类似验证身份上传身份证图片的功能. 效果图如下: 这里主要展示上传预览图片功能,对于删除功能的html及css写的比较粗糙,对于想要精细表现这 ...

  4. JavaScript 实现全选 / 反选功能

    JavaScript 实现全选 / 反选功能 版权声明:未经授权,内容严禁转载! 构建主体界面 编写 HTML 代码 和 CSS 代码,设计主题界面 <style> #user { wid ...

  5. [vs2008]Visual Studio 2008 SP1添加或删除功能提示查找SQLSysClrTypes.msi文件

    前言 今天接到领导布置的一个任务,是之前同事负责的项目.离职了,现在客户有些地方需要修改,由于我之前参与过,就落在我的头上了. 然后我就把代码弄了过来,打开发现其中需要用到水晶报表.(我觉得不好用,不 ...

  6. react.js CMS 删除功能的实现

    页面效果图: 数据操作分析: 在查询表组件的  TableData.js 中操作如下内容: 给每一行绑定一个checkbox,且在点击这个 checkbox 时,触发 action 中的一个方法(fo ...

  7. android EditText长按屏蔽ActionMode context菜单但保留选择工具功能

    最近项目要求屏蔽EditText 长按出来的ActionMode菜单,但是要保留选择文本功能.这个屏蔽百度会出现各种方法,这里说一下我的思路: 1.屏蔽百度可知setCustomSelectionAc ...

  8. ajax“显示弹窗详情”和“删除”功能练习

    1.查看详细信息,以弹窗的形式显示,使用ajax 2.批量删除 “查询”功能可以参考前面的文章,这里只讲解ajax“显示弹窗详情”和“删除”功能 第一:在body中的代码 <title>a ...

  9. jquery 书写全选反选功能

    书写一个后台管理中用到的全选反选功能.代码如下 <!DOCTYPE html> <html lang="en"> <head> <meta ...

随机推荐

  1. Unity5系列资源管理AssetBundle——加载

    上次我们进行了AssetBundle打包,现在我们还把打包的资源加载到我们的游戏中.在加载之前,我们需要把打包好的Bundle包裹放到服务器上,如果没有,也可以使用XAMPP搭建本地服务器. 加载的A ...

  2. Django中url匹配规则的补充

    Django中url匹配规则是在urls.py文件中配置的. 1.关于正则匹配优先级 在url匹配列表中,如果第一条和第二条同时满足匹配规则,则优先匹配第一条. 在url匹配列表中,如果第一条为正则模 ...

  3. vconfig 的使用

    http://man.cx/vconfig%288%29 vconfig 作用: (802.1q)VLAN配置程序 root@hbg:/# vconfig --helpBusyBox v1.22.1 ...

  4. LeetCode OJ 48. Rotate Image

    You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...

  5. 2016NEFU集训第n+3场 G - Tanya and Toys

    Description In Berland recently a new collection of toys went on sale. This collection consists of 1 ...

  6. ev=ev || window.event 与 ev = window.event || ev 区别

    event是事件对象(也是window的属性),但不是标准的,只有IE支持.在W3C标准支持的浏览器下事件对象是引发事件函数的第一个参数,参数名随意.var oEvent = ev || event; ...

  7. 关于springboot启动时候报错:springboot Failed to parse configuration class [Application]

    把运行的java类放在一个package下后就不再提示这个错误. 使用的ide是intellij,之前也有因为没有创建package报错的经历,可能这是intellij必须的

  8. 5.编写Java应用程序。首先,定义描述学生的类——Student,包括学号(int)、 姓名(String)、年龄(int)等属性;二个方法:Student(int stuNo,String name,int age) 用于对对象的初始化,outPut()用于输出学生信息。其次,再定义一个主类—— TestClass,在主类的main方法中创建多个Student类的对象,使用这些对象来测 试St

    Student类: package com.bao; public class Student { int stuNo;String name,sex;int age,weight; Student( ...

  9. python多线程,多进程

    线程是公用内存,进程内存相互独立 python多线程只能是一个cpu,java可以将多个线程平均分配到其他cpu上 以核为单位,所以GIL(全局锁,保证线程安全,数据被安全读取)最小只能控制一个核,很 ...

  10. 简单的JDBC连接oracle数据库例子

    java连接Oracle数据库 JDBC(Java Data Base Connectivity,java数据库连接),那么我们该如何用java进行数据库的连接呢. import java.sql.C ...