引入这个jquery-1.12.4.js

jquery实现全选 反选 取消

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
<input type="button" value="quanxuan" onclick="全选()"/>
<input type="button" value="fanxuan" onclick="反选()"/>
<input type="button" value="quxiao" onclick="取消()"/> <table>
<thead>
<tr>
<th>选择</th>
<th>ip</th>
<th>端口</th>
</tr> </thead>
<tbody class="tb">
<tr>
<td><input type="checkbox"/></td>
<td>1.1.1.</td>
<td>88</td> </tr>
<tr>
<td><input type="checkbox"/></td>
<td>1.1.1.</td>
<td>88</td> </tr>
<tr>
<td><input type="checkbox"/></td>
<td>1.1.1.</td>
<td>88</td> </tr>
</tbody>
</table>
<script src="jquery-1.12.4.js"></script>
<!--第一种方法-->
<script>
function quanxuan() {
$('input[type="checkbox"]').prop('checked', true)
}
function quxiao() {
$('input[type="checkbox"]').prop('checked', false)
}
// function fanxuan() {
// $('input[type="checkbox"]').each(function () {
// if(this.checked){
// this.checked=false
// }else {
// this.checked=true
// }
//
// })
// 用jquery实现反选
// checkbox radio 选择一定要用prop
//$().prop('checked') 获取值
//$().prop('checked',true) 设置值
function fanxuan() {
$('input[type="checkbox"]').each(function () {
if ($(this).prop("checked")) {
$(this).prop("checked", false)
} else {
$(this).prop("checked", true)
} }) } </script> </body>
</html>

python: jquery实现全选 反选 取消的更多相关文章

  1. jquery实现全选 反选 取消

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. jquery实现全选,取消,反选的功能&实现左侧菜单

    1.全选,取消,反选的例子 <!DOCTYPE html> <html lang="en"> <head> <meta charset=& ...

  3. jquery 书写全选反选功能

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

  4. jQuery --checkbox全选和取消全选简洁高效的解决办法

    最近在公司做了一个小项目,其中有一个全选和取消全选的这么一个模块,搞了半天找不到一种最佳的解决方案!后来通过各种努力找到了一种简洁高效的解决办法,这里想和大家分享一下.有问题的话,还望各路大神指导一二 ...

  5. jquery实现全选/反选功能

    <!DOCTYPE html><html><head> <meta http-equiv="Content-Type" content=& ...

  6. jQuery实现全选/反选和批量删除

    <%@ page language="java" contentType="text/html; charset=utf-8"     pageEncod ...

  7. jquery购物车全选,取消全选,计算总金额

    这是html代码 <div class="gwcxqbj"> <div class="gwcxd center"> <div cl ...

  8. jquery实现全选、取消反选、加JavaScript三元运算(三种法法实现反选)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. jquery 实现全选反选

    jquery代码 $(function () { $('#inputCheck').click(function () { if ($(this).attr("checked")) ...

随机推荐

  1. django向数据库添加数据

    url.py views.py host.html (样式) (展示部分) (添加信息界面) (js部分) 展示添加数据:

  2. Hibernate的延迟加载

    我们会分析load和get两种加载方式: 一.load加载方式 当使用load方法来得到一个对象时,此时hibernate会使用延迟加载的机制来加载这个对象,即:当我们使用session.load() ...

  3. C# - 时间格式

    如果是字符串,需要先转化为DateTime格式 DateTime ExDate = DateTime.Parse(dt.Rows[]["HKMonth"].ToNotNullStr ...

  4. 详解 Python 中的下划线命名规则

    在 python 中,下划线命名规则往往令初学者相当 疑惑:单下划线.双下划线.双下划线还分前后……那它们的作用与使用场景 到底有何区别呢?今天 就来聊聊这个话题. 1.单下划线(_) 通常情况下,单 ...

  5. Debug阶段成员贡献分

    组名:天天向上 组长:王森 组员:张政.张金生.林莉.胡丽娜 Debug阶段各组员的贡献分分配如下: 姓名 个人工作量 组长评价 个人评价 团队贡献总分 张金生 11 7 6 6.00 张政 11 6 ...

  6. Thinking in Java——笔记(7)

    Reusing Classes The first is composition,You're simply reusing the functionality of the code, not it ...

  7. 从.NET和Java之争谈IT这个行业[转]

    一.有些事情难以回头 开篇我得表名自己的立场:.NET JAVA同时使用者,但更加偏爱.NET.原因很简单 1.NET语言更具开放性,从开源协议和规范可以看出; 2.语言更具优势严谨; 3.开发工具V ...

  8. ASP.NET Global Application_Error事件中访问Session报错 解决

    报错信息:会话状态在此上下文中不可用 protected void Application_Error(object sender, EventArgs e) { //以此判断是否可用Session ...

  9. databasefactory.createdatabase Web.config 配置关键点提醒

    <configuration>  <configSections>    <section name="dataConfiguration" type ...

  10. 能套用的tab栏切换

    效果: 在style.js文件里封装了一个Show函数,有4个参数,di(当前点击的按钮),num(按钮个数,也可以说是下面具体内容个数),divn(一个id前缀,这个例子里是ta,),active( ...