<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'check.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<input type="checkbox" id="boxid" onclick="selAllNo()">全选/全不选
<hr>
<input type="checkbox" name="love"/>篮球
<input type="checkbox" name="love"/>足球
<input type="checkbox" name="love"/>乒乓球
<input type="checkbox" name="love"/>排球
<input type="checkbox" name="love"/>保龄球
<hr>
<input type="button" name="checkedAll" onclick="selAll()" value="全选">
<input type="button" name="checkedNo" onclick="selNo()" value="全不选">
<input type="button" name="checkedOther" onclick="selOther()" value="反选">
<script type="text/javascript">
function selAll(){
var loves = document.getElementsByName("love"); for(var i=0;i<loves.length;i++){
var love1 = loves[i];
love1.checked = true;
}
}
function selNo(){
var loves = document.getElementsByName("love"); for(var i=0;i<loves.length;i++){
var love1 = loves[i];
love1.checked = false;
}
}
function selOther(){
var loves = document.getElementsByName("love");
for(var i=0;i<loves.length;i++){
var love1 = loves[i];
if(love1.checked==true){
love1.checked = false;
}else{
love1.checked = true;
}
} }
function selAllNo(){
var boxid = document.getElementById("boxid");
if(boxid.checked==true){
selAll();
}else{
selNo();
}
}
</script>
</body>
</html>

简单的js反选,全选,全不选的更多相关文章

  1. 用 JS(JavaScript )实现多选、全选、反选

    JS小例题 学习内容: 需求 总结: 学习内容: 需求 用 JavaScript 实现全选.反选.多选 实现代码 <!DOCTYPE html PUBLIC "-//W3C//DTD ...

  2. JS实现全选、不选、反选

    思路:1.获取元素.2.用for循环历遍数组,把checkbox的checked设置为true即实现全选,把checkbox的checked设置为false即实现不选.3.通过if判断,如果check ...

  3. js实现全选/全不选、反选

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

  4. js实现复选框全选/全不选/反选

    js实现复选框全选/全不选/反选 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "h ...

  5. js(四) 全选/全不选和反选

    思路:通过选择全选的选框的状态stuts 即true/false控制其他选框. 首先 我们要通过.checked方法获取选框(全选/全不选)的值. function all(){ var stuts= ...

  6. 利用jQuery实现CheckBox全选/全不选/反选

    转自:http://www.cnblogs.com/linjiqin/p/3148259.html jQuery有些版本中实现CheckBox全选/全不选/反选会有bug,经测试jquery-1.3. ...

  7. 【jQuery】复选框的全选、反选,推断哪些复选框被选中

    本文与<[JavaScript]复选框的全选.反选.推断哪些复选框被选中>(点击打开链接)为姊妹篇,把里面内容再与jQuery框架中实现一次,相同做到例如以下的效果: 布局还是相同的布局, ...

  8. Java 多选框的全选、多选、反选(JQuery 实现)

    jQuery 实现全选.多选.反选 学习内容: 需求 总结: 学习内容: 需求 jQuery 实现全选.多选.反选 实现代码 <!DOCTYPE html> <html lang=& ...

  9. jquery 全选 全不选 反选

    1.概述 在项目中经常遇到列表中对复选框进行勾选操作,全选...反选.. 2. example <html> <body> <form id="test-for ...

随机推荐

  1. 用c写99乘法表

    int main(int argc,char **argv){ int a; for(a=1;a<=9;a++){ int b; for(b=1;b<=a;b++){ printf(&qu ...

  2. Flesch Reading Ease(模拟)

    http://poj.org/problem?id=3371 终于遇到简单一点的模拟题了.不过本人真心没有耐心读题目... 它的大致意思就是给一段合法的文章,求出这段文章的单词数,句子数,音节数,按照 ...

  3. Pie(二分)

    ime Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8930   Accepted: 3235   Special Judge De ...

  4. Ubuntu 中使用 谷歌日历

    简介 对于经常使用待办类软件的人来说,谷歌日历是个不错的选择.但每次,都要登录网页去查看,对于我这样的懒人来说似乎麻烦了些. 所以在网上找了个叫做 Calendar Indicator 的软件. 效果 ...

  5. Android安全bug ANDROID-8219321

    ANDROID-8219321漏洞主要源自Android ZipFile函数漏洞:没有进行校验重名entry逻辑漏洞,逻辑漏洞细节详见Google+文章和Bluebox Security提报Andro ...

  6. supesite 连 discuz 论坛记录

    上一篇,网站supesite里 有 config.php  这里记录访问地址,到时候可以更改这里变更域名或者外网地址. 这里同样也是 下载discuz,解压,bbs 下的文件为有效的内容,放到supe ...

  7. 工作中常用的QTP操作Excel函数

    前言 本文只是对工作中常用的EOM相关函数的整理,并不是要写个大而全的操作手册,如果想对EOM有更多的了解可以参考QTP的帮助文档或查看QTP安装目录\CodeSamplesPlus\UsingExc ...

  8. The Viewport Transformation

    英文帖子链接http://glasnost.itcarlow.ie/~powerk/GeneralGraphicsNotes/projection/viewport_transformation.ht ...

  9. c语言:蜗牛的爬行。

    main() { printf("hello,word!,第一次的c语言输出"); }

  10. Python中http请求方法库汇总

    最近在使用python做接口测试,发现python中http请求方法有许多种,今天抽点时间把相关内容整理,分享给大家,具体内容如下所示: 一.python自带库----urllib2 python自带 ...