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> ...
随机推荐
- 网站微信登录-python 实现
最近微信登录开放公测,为了方便微信用户使用,我们的产品也决定加上微信登录功能,然后就有了这篇笔记. 根据需求选择相应的登录方式 微信现在提供两种登录接入方式 移动应用微信登录 网站应用微信登录 这里我 ...
- 右键添加git bush here
由于sourcetree自动安装的git,导致右键没有git bush here,那么我们就自己添加一下. 运行regedit.exe进入注册表,在HKEY_CLASSES_ROOT\Director ...
- python中多线程
多线程 什么是多线程 开启线程的两种方式 进程和线程的区别 Thread对象的其他属性和方法 守护线程 死锁现象与递归锁 信号量.Event定时器 线程Queue 进程池和线程池 什么是多线程 在传统 ...
- 在SSH项目中实现分页效果
在实现分页的时候,我使用的是数据库下面的User表,实现的效果是通过分页查询 能够将表中的数据分页显示,点击相关的按钮实现:首页.上一页.下一页.末页的显示 1新建一个dynamic web proj ...
- MD文件
了解一个项目,恐怕首先都是通过其Readme文件了解信息.如果你以为Readme文件都是随便写写的那你就错了.github,oschina git gitcafe的代码托管平台上的项目的Readme. ...
- java之美妙的注解
注解 一.认识注解 先看百度百科对java注解的解释: 定义:注解(Annotation),也叫元数据.一种代码级别的说明.它是JDK1.5及以后版本引入的一个特性,与类.接口.枚举是在同一个层次.它 ...
- vue-cli 本地开发mock数据使用方法
vue-cli 中可以通过配置 proxyTable 解决开发环境的跨域问题,具体可以参考这篇文章: Vue-cli proxyTable 解决开发环境的跨域问题 如果后端接口尚未开发完成,前端开发一 ...
- poj3311 经典tsp问题
题目的大概意思就是一个人到一些城市送披萨,要求找到一条路径可以遍历每个城市后返回出发点,而且路径距离最短.最后输出最短距离就可以. 注意:每个城市可反复訪问多次. 因为题中明白说了两个城市间的直接可达 ...
- Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path resource
spring boot 写一个web项目,在使用spring-data-jpa的时候,启动报如下错误: Error starting ApplicationContext. To display th ...
- RHEL6安装Oracle 11g R2
收藏PDF版质料请点这里:http://download.csdn.net/detail/jifeng3518/6464999 1.使用DVD做yum源1.1.新建dvd挂载目录[root@oracl ...