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

    jquery的全选,全不选,反选:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="jqueryselect.aspx.cs" Inherits="WebApplication9.jqueryselect" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
        <script src="Scripts/jquery-1.7.1.js"></script>
        <script type="text/javascript">
    
            $(function () {
                $("#selectAll").click(function () {//全选
                    $("#playList :checkbox").attr("checked", true);
                });
    
                $("#unSelect").click(function () {//全不选
                    $("#playList :checkbox").attr("checked", false);
                });
    
                $("#reverse").click(function () {//反选
                    $("#playList :checkbox").each(function () {
                        $(this).attr("checked", !$(this).attr("checked"));
                    });
                });
            });
    
        </script>
    </head>
    <body>
      
    
    
    
        <div id="playList">
            <input type="checkbox" value="歌曲1" />歌曲1<br />
            <input type="checkbox" value="歌曲2" />歌曲2<br />
            <input type="checkbox" value="歌曲3" />歌曲3<br />
            <input type="checkbox" value="歌曲4" />歌曲4<br />
            <input type="checkbox" value="歌曲5" />歌曲5<br />
            <input type="checkbox" value="歌曲6" />歌曲6
        </div>
        <input type="button" value="全选" id="selectAll" />
        <input type="button" value="全不选" id="unSelect" />
        <input type="button" value="反选" id="reverse" />
    </body>
    
    </html>
    sometimes the hardest part isn't letting go,but rather start over
  • 相关阅读:
    eclipse中打断点debug无效
    Jenkins构建部署Maven项目
    自动生成实体类和xml
    session 控制单点登录
    eclipse team 没有svn
    easyui combobox 设置滚动条
    unkow jdbc driver : http://maven.apache.org
    easyui datagrid列显示图片
    mysql中计算日期整数差
    Map<String, Object>转Object,Object转 Map<String, Object>
  • 原文地址:https://www.cnblogs.com/zhumeiming/p/5656804.html
Copyright © 2011-2022 走看看