这段代码假定环境是一个ID为age-form的”form”,三个ID分别为”day”,”month”,”year”。
var currdate = new Date();
currdate.setFullYear(currdate.getFullYear() - age);
if ((currdate - mydate) < 0){
alert("Sorry,only persons over the age of " + age + " may enter this site");
return false;
}
return true;
});
currdate.setFullYear(currdate.getFullYear() - age);
if ((currdate - mydate) < 0){
alert("Sorry,only persons over the age of " + age + " may enter this site");
return false;
}
return true;
});