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>

  • 相关阅读:
    go入门4---数据
    hibernate之关联关系一对多
    hibernate的主键生成策略
    hibernate的入门
    struts--CRUD优化(图片上传)
    struts2--CRUD
    struts2--入
    Maven环境搭建
    EasyUI--增删改查
    easyui--权限管理
  • 原文地址:https://www.cnblogs.com/yuejiaming/p/6496999.html
Copyright © 2011-2022 走看看