zoukankan      html  css  js  c++  java
  • Checkbox 全选、反选

    1.全选、反选

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script src="http://cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
        <script type="text/javascript">
            $(function () {
                $("#selall").on("click", function () { $("#plalst :checkbox").prop("checked", true); });
                $("#selnone").on("click", function () { $("#plalst :checkbox").prop("checked", false); });
                $("#resver").on("click", function () { $("#plalst :checkbox").prop("checked", function (i, val) { return !val; }); });
                $("#chkAll").on("click", function () { $("#plalst :checkbox").prop("checked",  $("#chkAll").prop("checked")) });
    
            });
        </script>
    </head>
    <body>
        <div id="plalst">
            <input type="checkbox" />一队
            <input type="checkbox" />二队
            <input type="checkbox" />三队
            <input type="checkbox" />四队
            <input type="checkbox" />五队
            <input type="checkbox" />六队
        </div>
        <br /><br /><br />
        <input type="button" id="selall" value="全选" />
        <input type="button" id="selnone" value="全不选" />
        <input type="button" id="resver" value="反选" />
        <input type="checkbox" id="chkAll" /><label for="chkAll" >选择</label>
    </body>
    </html>

      在线测试:http://www.runoob.com/try/try.php?filename=tryjquery_hide

  • 相关阅读:
    B树
    23查找树和红黑树
    红黑树---满足红黑性质的二叉查找树
    AVL树---平衡的二叉查找树
    二叉查找树
    Ping程序
    ICMP:Internet控制报文协议
    Unix&Linux大学教程目录
    Linux文件系统
    git简介
  • 原文地址:https://www.cnblogs.com/slwangzi/p/5977066.html
Copyright © 2011-2022 走看看