<body Onload="CheckAge('07/02/1982')">
<script language="JavaScript">
function CheckAge(objField)
{
var regexp = /\d{2}\/\d{2}\/\d{4}/;
if(!objField.match(regexp)){
alert('Invalid date - format : MM/DD/YYYY');
return;
}
var day = objField.substr(3,2);
var month = objField.substr(0,2);
var year = objField.substr(6,4);
var d = new Date();
var age = d.getYear() - year;
if(d.getMonth()/1 < month){
age--;
}else if(d.getMonth()/1==month && d.getDay()/1<=day){
age--;
}
alert(age);
}
</script>
</body>