zoukankan      html  css  js  c++  java
  • js根据身份证号自动截取出生日期并填充/根据身份证号自动判断性别案例

    如下:

    //根据身份证号自动判断性别案例
    function selectSex(obj) {
        var customercode = $(obj).val();
        if (customercode.length == 18) {
            var sexcode = customercode.substring(16, 17);
            var birth = customercode.substring(6, 10) + "-" + customercode.substring(10, 12) + "-" + customercode.substring(12, 14);
            //偶数为女性,奇数为男性
            if ((sexcode & 1) === 0) {
                $("#buyerSex").val("000");
            } else {
                $("#buyerSex").val("001");
            }
            $('#birth').datebox('setValue', birth);
        }
    }

    检查身份证件有效期输入是否正确

    //检查身份证件有效期输入是否正确
    function checkidefctdate()
    {
        var idefctdate = $("#idefctdate").datetimebox("getValue");
        idefctdate = new Date(Date.parse(idefctdate.replace(/-/g, "/"))).valueOf();
        var nowDate = new Date().valueOf();
        if(idefctdate>nowDate){
            alert("证件有效期起始日期有误,请修改");
            return false;
        }
        return true;
    }

    根据easyUI时间控件取值参考

    var xxx= $("#loanbegindate").datebox('getValue');

    end!

  • 相关阅读:
    NSURLSessionDataDelegate 文件下载
    NSURLConnection 大文件下载
    全屏滑动
    qq粒子效果
    iOS 技巧
    iOS 15 新特性适配
    iOS 字符串转json 字符串转数组
    iOS 微信分享显示未验证应用2
    iOS 微信分享显示未验证应用1
    iOS 隐藏系统音量提示框
  • 原文地址:https://www.cnblogs.com/xh_Blog/p/13565670.html
Copyright © 2011-2022 走看看