js实现CheckBox全选或者不全选
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Checkbox1" name="all" type="checkbox" onclick="show()"/>全选/取消
<input id="Checkbox2" name="c1" type="checkbox" />1
<input id="Checkbox3" name="c1" type="checkbox" />2
<input id="Checkbox4" name="c1" type="checkbox" />3
<input id="Checkbox6" name="c1" type="checkbox" />4
<input id="Checkbox5" name="c1" type="checkbox" />5
</div>
</form>
</body>
<script>
function show()
{
//根据名字获取所有checkbox控件
var allCheckBoxs = document.getElementsByName("c1");
//半段点击了全选
if (document.getElementById("Checkbox1").checked == true) {
//循环让所有全选
for (var i = 0; i < allCheckBoxs.length ; i++) {
if (allCheckBoxs[i].type == "checkbox") {
allCheckBoxs[i].checked = true;
}
}
}
//点击了取消全选
else {
//循环取消全选
for (var i = 0; i < allCheckBoxs.length ; i++) {
if (allCheckBoxs[i].type == "checkbox") {
allCheckBoxs[i].checked = false;
}
}
}
}
</script>
</html>
js实现CheckBox全选或者不全选的更多相关文章
- 原生JS实现全选和不全选
案例演示 源代码 <!DOCTYPE html> <html> <head lang="en"> <meta charset=" ...
- JS对checkbox全选和取消全选
需求:checkbox控制列表数据全选与取消全选择. 效果图: 1.html <body > <input type="button" name="in ...
- jquery、js操作checkbox全选反选
全选反选checkbox在实际应用中比较常见,本文有个不错的示例,大家可以参考下 操作checkbox,全选反选//全选 function checkAll() { $('input[name=&qu ...
- js解决checkbox全选和反选的问题
function SelectAll() { var checkboxs=document.getElementsByName("chk_list"); for (var i=0; ...
- js实现checkbox全选与反选
<script type="text/javascript" language="javascript"> function checkAll(id ...
- jQuery给CheckBox全选与不全选
$(function(){ $("#checkAll").click(function() {//全选 $('input[name="DATA"]').prop ...
- js实现checkbox全选,全部选和反选效果
效果: 源码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...
- JS控制checkbox全选、取消全选、删除功能的代码贴出来。。
function checkAll() { var code_Values = document.getElementsByTagName("input"); for(i = 0; ...
- jquery全选或不全选时,不操作已经禁用的checkbox
$("#selectAll").click(function(){ if(this.checked ){ $(":checkbox[name='equid']" ...
随机推荐
- centos下安装ffmpeg加上fdk-aac的支持
本文参考自:https://blog.csdn.net/jklinux/article/details/72367829 安装包可以从这里下载https://download.csdn.net/dow ...
- CentOS 7 yum Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile
yum install nginx发生的错误 yum install nginx Loaded plugins: fastestmirror, ovl Loading mirror speeds fr ...
- typescript属性类型接口
/* typeScript中的接口 - 1.属性类接口 */ /* 接口的作用:在面向对象的编程中,接口是一种规范的定义,它定义了行为和动作的规范,在程序设计里面,接口起到一种限制和规范的作用.接口定 ...
- 将PCM格式存储成WAV格式文件
将PCM格式存储成WAV格式文件 WAV比PCM多44个字节(在文件头位置多) 摘自:https://blog.csdn.net/u012173922/article/details/78849076 ...
- Mysql关键字之Group By(二)
原文地址,优先更新https://hhe0.github.io 我们在上一节简单介绍了Mysql中group by关键字的用法,没有看过的同学点击这里了解一下; 文中提到的courses表和相关记录可 ...
- 安装kubernet(k8s)
简介: 需要学习的都明白,这里就不赘述了. 本文采用CentOS-7-x86_64-DVD-1810.iso 一:安装操作系统 本来是喜欢用fedora的,但是fedora貌似包维护的不好,就又开始用 ...
- idea里面lombok要如何设置后才会生效
16:31 Lombok Requires Annotation Processing Annotation processing seems to be disabled for the proje ...
- spring boot如何打印mybatis的执行sql
方案一 application.properties配置: logging.level.com,后面的路径指的是mybatis对应的方法接口所在的包.并不是mapper.xml所在的包. 1. log ...
- Ubuntu18安装虚拟机virtualbox
环境查看 安装虚拟机 apt install virtualbox 图形化界面启动 virtualbox 其余创建虚拟机和安装和在Windows安装配置一样,不详述.
- 最新 安易迅java校招面经 (含整理过的面试题大全)
从6月到10月,经过4个月努力和坚持,自己有幸拿到了网易雷火.京东.去哪儿. 安易迅等10家互联网公司的校招Offer,因为某些自身原因最终选择了 安易迅.6.7月主要是做系统复习.项目复盘.Leet ...