This client wanted a max age of 25 on their site so i tossed this together for them, it seems to work. Im sure their maybe a quicker way but this looks and seems to be pretty solid... Please correct if you see anything..

I did test this numerious times and seems to work well.

Thanks..

note, my dob is not entered in one input, it is entered in three sep inputs so i already luckily have it split up for me.

happy coding... peaceCode:<script type="text/javascript"> function gettheage() { var subone = 0; /* get cur date */ var todaysdate = new Date(); /* get values dd mm yyyy of bd */ var dobday = document.getElementById('lstDay').value; var dobmo = document.getElementById('lstMonth').value; var dobyear = document.getElementById('txtYear').value; /* last two only */ var dobyear = '19' + dobyear; /* concat the 19 to the front */ /* get values of dd mm yyyy of todays date */ var curday = todaysdate.getDate(); var curmo = todaysdate.getMonth() + 1; var curyr = todaysdate.getFullYear(); /* the calc of age below assumes this year also */ /* now lets find out if we need to subtract one for this year or not */ /* if curent month is greater than dob month */ /* do nothing you have already assumed this year so leave it be */ /* if curent month is less than the dob month then subtract one for this year */ if(curmo < dobmo) { var subone = -1; }else{ /* if current month is equal to dob month then check the day */ if(curmo == dobmo) { /* if the curent day is geater or eq to the dob day then leave it be */ /* you have already assumed this year */ /* if current day is less than dob day then subtract this year */ if(curday < dobday) { var subone = -1; }//close if }//close if }//close else /* subtract dob year from current year plus subone if necessary to get the age */ var theirage = (curyr - dobyear) + subone; /* adding -1 or 0 */ if(theirage > 25) { /* post the over age in the auto calculate input and go back to the birthday day */ document.getElementById('newmemage').value = theirage; alert("Sorry but Maximum age for this website is 25 years old"); document.FrmRegister.lstDay.focus(); return (false); }else{ /* post the age in the auto calculate input and move to the next field*/ document.getElementById('newmemage').value = theirage; document.getElementById('lstSex').focus(); }//close else return (true); }//close function gettheage