根据身份证计算年龄方法
// 根据身份证计算年龄 function IdCard(value) { var myDate = new Date(); var month = myDate.getMonth() + 1; var day = myDate.getDate(); var age = myDate.getFullYear() - value.substring(6, 10) - 1; if (value.substring(10, 12) < month || value.substring(10, 12) == month && value.substring(12, 14) <= day) { age++; } return age; }