zoukankan      html  css  js  c++  java
  • Juery实现的小案例1、实现复选框的全选、全不选以及反选

    <html>
    <head>
        <meta charset="utf-8"/>
        <script  src="jquery-1.4.2.min.js"></script>//在此处的Jquery文件封装的js文件下载地址http://download.csdn.net/detail/feilong_12/5210621
        <script>
        $(function(){
                        $("#checkAll").click(function(){
                        $(":checkbox").attr("checked",true);
                        });
                        $("#checkNo").click(function(){
                        $(":checkbox").attr("checked",false);
                        });
                        $("#checkRes").click(function(){
                $("input:checkbox[name=items]").each(function(){
                        $(this).attr("checked",!$(this).attr("checked"))    ;        
                        });
                        })
                })
        </script>
    </head>
    <body>
        <form action="#" method="post">
                <input type="checkbox" name="items" value="篮球" />篮球
                <input type="checkbox" name="items" value="足球" />足球
                <input type="checkbox" name="items" value="篮球" />乒乓球
                <input type="checkbox" name="items" value="篮球" />羽毛球
                <input type="button" id="checkAll" value="全选"/>
                <input type="button" id="checkNo" value="全不选"/>
                <input type="button" id="checkRes" value="反选"/>
        </form>
    </body>
    </html>

  • 相关阅读:
    程序员数学
    [topcoder]FlowerGarden
    [leetcode]Trapping Rain Water
    [leetcode]Gray Code
    [leetcode]Unique Paths II
    hdu 4112 Break the Chocolate(ceil floor)
    【转】博弈-翻硬币游戏
    POJ 3710 Christmas Game
    hdu 3590 PP and QQ
    博弈进阶
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/2995441.html
Copyright © 2011-2022 走看看