zoukankan      html  css  js  c++  java
  • jquery全选反选

    View Code
    <head>
    <title></title>

    <script src="js/jquery-1.4.2.js" type="text/javascript"></script>

    <script type="text/javascript">
    $(
    function() {
    $(
    "#selall").click(function() { //取得id为aaa的标签下面的类型为chexkbox的控件。 $("#aaa :checkbox").attr("checked", true);// 将其checked属性实质为true
    });
    });
    $(
    function() {
    $(
    "#noselall").click(function() { //取得id为aaa的标签下面的类型为chexkbox的控件。
    $("#aaa :checkbox").attr("checked", false); // 将其checked属性实质为false
    });
    });
    $(
    function() {
    $(
    "#reverse").click(function() { //取得id为reserse的控件
    $("#aaa :checkbox").each(function() { //遍历其类型为checkbox的空间
    $(this).attr("checked",!$(this).attr("checked"))//将选择的取消,取消的选择
    });
    });
    });
    </script>

    </head>
    <body>
    <div id="aaa">
    <input type="checkbox"/>歌曲一<br />
    <input type="checkbox"/>歌曲二<br />
    <input type="checkbox"/>歌曲三<br />
    <input type="checkbox"/>歌曲四<br />
    </div>
    <input id="selall" type="button" value="全选"/>
    <input id="noselall" type="button" value="全部选"/>
    <input id="reverse" type="button" value="反选"/>
    </body>
  • 相关阅读:
    获取所有部门中当前员工薪水最高的相关信息,给出dept_no, emp_no以及其对应的salary
    获取所有员工当前的manager,如果当前的manager是自己的话结果不显示
    String笔记02
    String笔记
    ArrayList笔记
    猜数字小游戏
    标准类
    封装
    面向对象
    方法
  • 原文地址:https://www.cnblogs.com/happygx/p/1982054.html
Copyright © 2011-2022 走看看