PHP全选择删除功能
<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全选择删除功能的更多相关文章
- vue实战记录(五)- vue实现购物车功能之商品总金额计算和单选全选删除功能
vue实战,一步步实现vue购物车功能的过程记录,课程与素材来自慕课网,自己搭建了express本地服务器来请求数据 作者:狐狸家的鱼 本文链接:vue实战-实现购物车功能(五) GitHub:sue ...
- 当你的layui表格要做全选+删除功能【兼容ie8】
<!-- 全选 --> <div class="choose"> <input type="checkbox" id=" ...
- input file样式修改,图片预览删除功能
本篇对input file进行了修改,改成自己需要的样式,类似验证身份上传身份证图片的功能. 效果图如下: 这里主要展示上传预览图片功能,对于删除功能的html及css写的比较粗糙,对于想要精细表现这 ...
- JavaScript 实现全选 / 反选功能
JavaScript 实现全选 / 反选功能 版权声明:未经授权,内容严禁转载! 构建主体界面 编写 HTML 代码 和 CSS 代码,设计主题界面 <style> #user { wid ...
- [vs2008]Visual Studio 2008 SP1添加或删除功能提示查找SQLSysClrTypes.msi文件
前言 今天接到领导布置的一个任务,是之前同事负责的项目.离职了,现在客户有些地方需要修改,由于我之前参与过,就落在我的头上了. 然后我就把代码弄了过来,打开发现其中需要用到水晶报表.(我觉得不好用,不 ...
- react.js CMS 删除功能的实现
页面效果图: 数据操作分析: 在查询表组件的 TableData.js 中操作如下内容: 给每一行绑定一个checkbox,且在点击这个 checkbox 时,触发 action 中的一个方法(fo ...
- android EditText长按屏蔽ActionMode context菜单但保留选择工具功能
最近项目要求屏蔽EditText 长按出来的ActionMode菜单,但是要保留选择文本功能.这个屏蔽百度会出现各种方法,这里说一下我的思路: 1.屏蔽百度可知setCustomSelectionAc ...
- ajax“显示弹窗详情”和“删除”功能练习
1.查看详细信息,以弹窗的形式显示,使用ajax 2.批量删除 “查询”功能可以参考前面的文章,这里只讲解ajax“显示弹窗详情”和“删除”功能 第一:在body中的代码 <title>a ...
- jquery 书写全选反选功能
书写一个后台管理中用到的全选反选功能.代码如下 <!DOCTYPE html> <html lang="en"> <head> <meta ...
随机推荐
- 【🉐】 彻底理解webservice SOAP WSDL
原文: http://wenku.baidu.com/view/f87b55f19e31433239689314.html WebServices简介 先给出一个概念 SOA ,即Service Or ...
- Zeppelin使用spark解释器
Zeppelin为0.5.6 Zeppelin默认自带本地spark,可以不依赖任何集群,下载bin包,解压安装就可以使用. 使用其他的spark集群在yarn模式下. 配置: vi zeppelin ...
- Storm常见问题处理
错误1:发布topologies到远程集群时,出现Nimbus host is not set异常.异常内容如下所示: [root@xop-dev-a bin]# ./storm jar /home/ ...
- 站在Java的角度看LinkedList
站在Java的角度看,玩队列不就是玩对象引用对象嘛! public class LinkedList<E> implements List<E>, Deque<E> ...
- Delphi用ADOquery主从表例子(转)
http://blog.csdn.net/kandy_zheng/article/details/1639184 在sql server 的northwide 中建立主表 create table s ...
- chapter8_2 预编译
用luac程序可以生成一个预编译文件——二进制文件. 比如: luac -o prog.lc prog.lua --生成了prog.lc二进制文件 Lua解析器可以执行它就像执行普通lua代码一样. ...
- php 正则表达式 数组
正则表达式 斜杠代表定界符 /^$/ $str = "好厉害18653378660了hi请勿嫁得好15165339515安徽dah矮冬瓜 拍行业大概啊好广东也欺负偶怕哈";$reg ...
- Yii2.0的安装与配置教程
版权声明:本文为博主原创文章,未经博主允许不得转载. PHP版本需求:PHP5.4.0以上,因为Yii2.0基于PHP5.4以上版本进行了完全重写. 目前有两种方法可以安装Yii2.0,一种是安装Co ...
- 2016-11-10linux
---恢复内容开始--- 新建用户natasha,uid为88,gid为6,备注信息为"master" 修改natasha用户的家目录为/Natasha 查看用户信息配 ...
- C++中复制构造函数和赋值操作符
先看一个例子: 定义了一个类: