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 ...
随机推荐
- javascript基础(三)运算
原文http://pij.robinqu.me/ 递增递减操作符(包括前置和后置).一元正负符号操作符 这些操作符适用于任何数据类型的值,针对不同类型的值,该操作符遵循以下规则(经过对比发现,其规则与 ...
- .Net Core 学习资料
官方网站:https://www.microsoft.com/net/core#windows 官方文档:https://docs.asp.net/en/latest/intro.html 中 ...
- UNIX基础--控制台和终端
虚拟控制台和终端 Virtual Consoles and Terminals: FreeBSD 虚拟控制台的默认配置为8个,但并不是硬性设置, 您可以很容易设置虚拟控制台的个数增多或减少. 虚拟控制 ...
- chapter11_3 字符串缓冲
逐行地读取一个文件,典型的代码是: local buff= " " for line in io.lines() do buff = buff .. line .. "\ ...
- 洛谷-火柴棒等式-NOIP2008提高组复赛
题目描述 Description 给你n根火柴棍,你可以拼出多少个形如“A+B=C”的等式?等式中的A.B.C是用火柴棍拼出的整数(若该数非零,则最高位不能是0).用火柴棍拼数字0-9的拼法如图所示: ...
- HttpServletResponse应用----生成验证码
1.1生成随机图片用作验证码 生成图片主要用到BufferedImage类 package gacl.response.study;import java.awt.Color;import java. ...
- javascript动画效果之任意效果任意值
通过学习,我发现当同一个ul下的li标签如果想要不同的效果,那怎么办? 比如第一个li是width变化,第二个li为透明度(opacity)变化,而opacity的值和width的值类型不同,不能通用 ...
- MATLAB将变量存储到EXCEL
代码如下: d = {'Time','Temperature'; 12,98; 13,99; 14,97}; xlswrite('testdata2.xls', d, 1, 'E1') 运行如下:
- 网页 JavaScript的DOM操作
今天,我首先对之前学习的内容进行了复习,然后学习了当鼠标指向某一个按钮时,切换对应的背景图片. <div id="d1"> </div> <input ...
- 【开发笔记】Spring的配置文件
factory-method竟然写成了destroy-method,害得我运行报错,找原因找了几分钟. 原来我按alt+/来提示代码的时候,有许多可选项,可能一时眼花选错了