zoukankan      html  css  js  c++  java
  • 购物车全选 和取消功能

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>购物车 全选</title>
    <script src="http://www.aniu.tv/Public/Common/js/jquery.min.js"></script>
    </head>
    <script type="text/javascript">
    $(function(){
    $('.all').click(function(){
    if($('.all').is(':checked')){
    $('.check').prop('checked',true);
    }else{
    $('.check').prop('checked',false);

    });
    $('.check').click(function(){
    var i = 0;
    var arr = $('.check').length;
    $('.check').each(function(){
    if($(this).is(':checked')){
    i++;
    };
    });
    if(i == arr){
    $('.all').prop('checked',true);
    }else{
    $('.all').prop('checked',false);
    }

    });
    });
    </script>
    </head>
    <body>
    <input class="all" type="checkbox" id="selectAll">全选
    <input class="check" type="checkbox">
    <input class="check" type="checkbox">
    <input class="check" type="checkbox"> 
    </body>
    </html>

  • 相关阅读:
    Windows系统结构
    Windows系统基本概念
    基本NT式驱动代码结构
    数据切割
    虚函数
    基类和派生类:谈继承
    jQuery简单的上拉加载
    检测是否为数组
    倒计时案例分析
    获得总的毫秒数
  • 原文地址:https://www.cnblogs.com/yuejiaming/p/6496999.html
Copyright © 2011-2022 走看看