zoukankan      html  css  js  c++  java
  • jquery 常用工具方法

    //计算年龄
    calcAge : function(birthday, calcDate){
    var num = (calcDate.getMonth()<birthday.getMonth() || calcDate.getMonth()==birthday.getMonth() && calcDate.getDate()<birthday.getDate())?1:0;
    return calcDate.getFullYear()-birthday.getFullYear() - num;
    },
    //字符串转日期
    string2Date : function(date){
    var sd = date.split('-');
    return new Date(sd[0],sd[1] - 1,sd[2]);
    },
    //日期转字符串
    date2String : function(data) {
    if (!data) {
    return "";
    }
    var date = new Date(data);
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    month = month >= 10 ? month : "0" + month;
    day = day >= 10 ? day : "0" + day;
    return year + "-" + month + "-" + day;
    },
    //点全选checkbox
    checkAll : function (){
    var checked = $("#checkAllBox").prop("checked");
    $('input[name="subCheckbox"]').prop('checked',checked);
    },
    //若有项目取消勾选,全选取消,否则全选勾选
    ifCheckAll : function (){
    var roles = $('input[name="subCheckbox"]');
    for(var i = 0 ; i < roles.length ; i++){
    if(!roles[i].checked){
    $("#checkAllBox").prop("checked",false);
    return;
    }
    }
    $("#checkAllBox").prop("checked",true);
    },

  • 相关阅读:
    autofac meta
    RazorEngine 3.6.5.0
    pfx 转 snk
    git
    Nlog Layout
    NLog 传递参数
    扫描.net dll引用dll
    vbox android x86 分辨率
    Andriod x86 4,4
    .net cli 源码
  • 原文地址:https://www.cnblogs.com/sam-uncle/p/11240905.html
Copyright © 2011-2022 走看看