jquery实现全选,取消,反选的功能&实现左侧菜单
1、全选,取消,反选的例子
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>全选以及取消测试</title>
</head>
<body>
<table border="1">
<thead>
<tr>
<th>
选择按钮
</th>
<th>
内容
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox">
</td>
<td>
123
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>
456
</td>
</tr>
<tr>
<td>
<input type="checkbox">
</td>
<td>
789
</td>
</tr>
</tbody>
</table>
<input type="radio" name='cc' onclick="select_all()">:全选
<input type="radio" name='cc' onclick="clear_all()">:取消
<input type="radio" name='cc' onclick="reverse_all()">:反选 <script src="jquery-3.2.1.js"></script>
<script>
function select_all() {
$("table input[type='checkbox']").prop('checked',true)
}
function clear_all() {
$("table input[type='checkbox']").prop('checked',false)
} function reverse_all() {
// var list = $("table input[type='checkbox']")
$("table input[type='checkbox']").each(function () {
var ischecked = $(this).prop('checked')
if(ischecked){
$(this).prop('checked',false)
}else {
$(this).prop("checked",true)
}
}) } </script>
</body>
</html>
2、左侧菜单的例子
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>左侧菜单例子</title>
<style>
.aa{
background-color: greenyellow;
width: 30%;
height: 500px;
border-color: orange;
/*border-width: 4px;*/
border-style: solid;
float: left;
}
.bb{
background-color: aqua;
width: 69%;
height: 500px;
border-style:dashed;
/*border-width: 6px;*/
border-color: orange;
float: right; }
.cc{
font-size: 40px; }
.dd{
border-color: red;
border-style: solid;
background-color:black;
color: white;
}
.ee{
display: none;
}
</style>
</head>
<body>
<div class="aa">
<div>
<strong class="cc" onclick="func(this)">菜单1</strong>
<div class="dd ee">
<div>内容1</div>
<div>内容2</div>
<div>内容3</div>
<div>内容4</div>
</div>
</div>
<div>
<strong class="cc" onclick="func(this)">菜单2</strong>
<div class="dd ee">
<div>内容1</div>
<div>内容2</div>
<div>内容3</div>
<div>内容4</div>
</div>
</div>
<div>
<strong class="cc" onclick="func(this)">菜单3</strong>
<div class="dd ee">
<div>内容1</div>
<div>内容2</div>
<div>内容3</div>
<div>内容4</div>
</div>
</div> </div>
<div class="bb">内容</div> <script src="jquery-3.2.1.js"></script>
<script>
function func(ths) {
$(ths).next("div").removeClass("ee")
$(ths).parent().siblings("div").children("div").addClass("ee") }
</script> </body>
</html>
jquery实现全选,取消,反选的功能&实现左侧菜单的更多相关文章
- (转载)jquery实现全选、反选、获得所有选中的checkbox
举了7个不同的checkbox状态,和大家一一分享. 1.全选 $("#btn1").click(function(){ $("input[name='checkbox' ...
- jquery实现全选、反选、不选
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8&quo ...
- jQuery实现全选、反选和不选功能
HTML 我们的页面上有一个歌曲列表,列出多行歌曲名称,并匹配复选框供用户选择,并且在列表下方有一排操作按钮. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 <ul id=&q ...
- 利用JQuery实现全选和反选的几种方法
前面介绍了利用JavaScript实现全选功能,其中也有要注意的几点,现在讲解下在JQuery怎么实现全选和反选,下面提供了两种方法实现. 如图:要实现的效果是点击全选框全部选中,再点击全部不选中 方 ...
- JQuery实现全选、反选和取消功能
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- jquery实现全选,反选,取消的操作
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 用JavaScript实现CheckBox的全选取消反选,及遮罩层中添加内容
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- jQuery实现全选、反选、删除
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content ...
- Jquery,全选,反选,
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
随机推荐
- 再谈Spring AOP
1.AOP的基本概念 在进行AOP开发前,先熟悉几个概念: 连接点(Jointpoint):表示需要在程序中插入横切关注点的扩展点,连接点可能是类初始化.方法执行.方法调用.字段调用或处理异常等等,S ...
- 从U-Boot显示Logo到Android
/******************************************************************************* * 从U-Boot显示Logo到And ...
- [笔记] linux中的计划任务crontab
不能拒绝进步 cron来源于希腊单词chronos(意为"时间"),指linux系统下一个自动执行指定任务的程序(计划任务). 1--crontab 的命令选项 #crontab ...
- UOJ117. 欧拉回路【欧拉回路模板题】
LINK 题目大意 就是让你对有向图和无向图分别求欧拉回路 非常的模板,但是由于UOJ上毒瘤群众太多了 所以你必须加上一个小优化 就是每次访问过一个边就把它删掉 有点像Dinic的当前弧优化的感觉 注 ...
- 离散数学:用C语言来判断集合存在的二元关系
用C语言来判断是否满足自反,反自反,非自反,对称,反对称,非对称和传递性 也不知道写的对不对.没有大量验证,但是随便找的一些关系测试的没毛病,如果错了,欢迎各位大佬留言 #include<bit ...
- Web Server部署架构图
一.整体架构图 二.框架的瓶颈 上述框架的瓶颈在存储NFS,现在较多的使用的是GFS分布式存储
- list_for_each与list_for_each_entry具体解释
一.list_for_each 1.list_for_each原型#define list_for_each(pos, head) \ for (pos = (head)->next, ...
- X.509证书的编码及解析:程序解析以及winhex模板解析
一.证书的整体结构:证书内容.签名算法.签名结果. 用ASN.1语法描述如下: Certificate::=SEQUENCE{ tbsCertificate TBSCertificate, signa ...
- Build fast jar 打包,增加配置文件
Build fast jar 打包,增加配置文件
- Hadoop编译安装
本文转载自:http://www.cnblogs.com/shishanyuan/p/4701646.html 1.编译Hadooop 1.1 搭建环境 1.1.1 安装并设置maven 1. 下载m ...