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 ...
随机推荐
- hdu_3247_Resource Archiver(AC自动机+bfs+TSP)
题目链接:hdu_3247_Resource Archiver 题意: 有n个资源串,m个病毒串,现在要将所有的资源串整合到一个串内,并且这个串不能包括病毒串,问最短的串长为多少 题解: 将资源串和病 ...
- Spring声明式事务配置中propagation各个值的意思
值 含义 REQUIRED 支持当前事务,如果当前没有事务,就新建一个事务. SUPPORTS 支持当前事务,如果当前没有事务,就以非事务方式执行. MANDATORY 支持当前事务,如果当前没有事务 ...
- hellobruce
- NOIP2012-普及组复赛-第二题-寻宝
题目描述 Description 传说很遥远的藏宝楼顶层藏着诱人的宝藏.小明历尽千辛万苦终于找到传说中的这个藏宝楼,藏宝楼的门口竖着一个木板,上面写有几个大字:寻宝说明书.说明书的内容如下:藏宝楼共有 ...
- app测试--稳定性测试
稳定性测试的概念有2种, 一, 稳定性测试,对应于异常性测试,即发生异常情况时,系统如何反应的测试.包含: 1 交互性测试,被打扰的情况,如来电,短信,低电量等.这些其实在上章的功能测试中有提到. 2 ...
- getScrollX()理解
- Chapter 2 Open Book——9
When I was finished with that, I took my book bag upstairs. Before starting my homework, I changed i ...
- 类型“GridView”的控件必须放在具有 runat=server 的窗体标记内?
Response.AddHeader("content-disposition", "attachment;filename=CRM.xls") Respons ...
- 第四十二节,configparser特定格式的ini配置文件模块
configparser用于处理特定格式的文件,其本质上是利用open来操作文件. 特定格式的ini配置文件模块,用于处理ini配置文件,注意:这个ini配置文件,只是ini文件名称的文本文件,不是后 ...
- Centos sudo添加用户
$ su - # vi /etc/sudoers 在root ALL=(ALL) ALL下 添加 username ALL=(ALL) ALL 输入wq!强制保存.