//this.new_num=1311*************
this.new_num.substring(6, 10) + "-" + this.new_num.substring(10, 12) + "-" + this.new_num.substring(12, 14);
//获取年龄
var myDate = new Date();
var month = myDate.getMonth() + 1;
var day = myDate.getDate();
var age = myDate.getFullYear() - this.new_num.substring(6, 10) - 1;
if(this.new_num.substring(10, 12) < month || this.new_num.substring(10, 12) == month && this.new_num.substring(12, 14) <= day) {
age++;
}
if(age>18){
alert("成年人")
}else{
alert("未成年")
}
网友评论