zoukankan      html  css  js  c++  java
  • 全选全不选

    全选全不选

    <!doctype html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
      <meta name="Generator" content="EditPlus®">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
     </head>
    <script type="text/javascript">
    <!--
        function checkAll(flag){
            //拿到所有的多选框
            var hobbys = document.getElementsByName("hobby");
            //循环赋值
            for(var i = 0; i < hobbys.length; i++){
                hobbys[i].checked = flag;
            }
        }
        function reverseCheck(){
            //拿到所有的多选框
            var hobbys = document.getElementsByName("hobby");
            //循环赋值,取反
            for(var i = 0; i < hobbys.length; i++){
                hobbys[i].checked = !hobbys[i].checked;
            }
        }
        
    //-->
    </script>
    
     <body>
    全选/全不选 <input type="checkbox" name="hobbys" onclick="checkAll(this.checked)"> <br><br>
    反选 <input type="checkbox" name="hobbys" onclick="reverseCheck()"> <br><br>
            <input type = "checkbox" name="hobby" value="football">足球
            <input type = "checkbox" name="hobby" value="football">篮球
            <input type = "checkbox" name="hobby" value="football">棒球
            <input type = "checkbox" name="hobby" value="football">乒乓球
            <input type = "checkbox" name="hobby" value="football">橄榄球
            <input type = "checkbox" name="hobby" value="football">网球
            <input type = "checkbox" name="hobby" value="football">马球
     </body>
    </html>
  • 相关阅读:
    Java面向对象XMind
    使用idea插件JRebel热部署的坑
    Mysql小技巧(多行数据合并+模糊查询
    JRebel安装使用
    Shiro(三) 权限管理 假数据
    Shiro(二)通过shiro实现登录 连接数据库+集成Springboot
    Shiro(一)通过shiro实现登录
    poi实现Excel输出
    日志,注解切入点
    获取用户信息
  • 原文地址:https://www.cnblogs.com/taiguyiba/p/6195179.html
Copyright © 2011-2022 走看看