引入这个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. Odoo 采购单 加盖 电子公章

    简单说一下思路,第一步呢是要有一个电子公章的图片,第二步就是把这张图片添加到生成的PDF文件中. 最后的效果图如下:

  2. SBT Assembly - Deduplicate error & Exclude error

    sbt assembly java.lang.RuntimeException: deduplicate: different file contents found in the following ...

  3. 下载包含src,tgz,zip的文件

    下载哪一个文件? 含src的是源码文件,含tgz和zip的分别是linux和windows系统下jar包(java文件包) asc,md5,sha1是三种加密文件,可用于判断文件是否被修改. Ente ...

  4. BizTalk开发系列(三十六) Orchestration单实例执行

    BizTalk 是高效的消息处理引擎,采用多线程并发的方式来处理消息.也就是说当有消息被接收的时候就会产生一个新的消息处理实例.但有时目标系统可能并没有并发处理 的能力, 这时就需要在BizTalk中 ...

  5. php课程---简单的分页练习

    在写代码时,我们可以用类来使代码更加方便简洁,下面是一个简单的查询分页练习 源代码: <html> <head> <style type="text/css&q ...

  6. FCM算法

    FCM算法是一种基于划分的聚类算法,它的思想就是使得被划分到同一簇的对象之间相似度最大,而不同簇之间的相似度最小.模糊C均值算法是普通C均值算法的改进,普通C均值算法对于数据的划分是硬性的,而FCM则 ...

  7. 面向系统管理员的10款Linux GUI工具 (转自51cto)

    如果你是名系统管理员,现已到了Linux非知道不可的地步.如果你在更庞大的环境下工作,更是如此.许多企业组织已迁离了一切都借助点击式GUI来管理的Windows.幸好,Linux也有许多GUI工具可以 ...

  8. ng-model和ng-bind区别

    ng-bind has one-way data binding ($scope --> view). It has a shortcut {{ val }} which displays th ...

  9. A trip through the Graphics Pipeline 2011_09_Pixel processing – “join phase”

    Welcome back!    This post deals with the second half of pixel processing, the “join phase”. The pre ...

  10. wpf 将Style应用到 ListView 中的 ListViewItem 元素

    例: 为每个条目元素设置右键菜单 1. 新建右键菜单元素和样式元素 注意: 同时设置样式元素的 TargetType 属性和 x:Key 属性, 将样式元素限定为应用于 ListViewItem 类型 ...