$("#buttonBirthday").click(function() {
var idCard = $("#strIdCard").val();
var birthday = "";
if (idCard == "") {
alert("请输入身份证号")
} else {
if (idCard.length == 15) {
birthday = "19" + idCard.substr(6, 6)
} else if (idCard.length == 18) {
birthday = idCard.substr(6, 8)
}
birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
$("#valueDay").val(birthday);
}
});
$("#buttonSex").click(function() {
var idCard = $("#strIdCard").val();
var birthday = "";
var sexno = "";
if (idCard == "") {
alert("请输入身份证号")
} else {
if (idCard.length == 15) {
sexno = idCard.substr(14, 15)
} else if (idCard.length == 18) {
sexno = idCard.substr(16, 17)
}
var tempid = sexno % 2;
if (tempid == 0) {
sexname = '女'
} else {
sexname = '男'
}
$("#valueSex").val(sexname);
}
});