<SCRIPT>
function count_dat(){
/* 誕生日 */
var _birth=new Date(1976,12,24);
var _birth_year=_birth.getYear();
var _birth_mon=_birth.getMonth();
var _birth_dat=_birth.getDate();
/* 今日を求める */
var _today=new Date();
var _today_year=_today.getYear();
var _today_mon=_today.getMonth()+1;
var _today_dat=_today.getDate();
/* 比較 */
var _adjust;
if(_birth_mon > _today_mon){_adjust=-1;}
if(_birth_mon == _today_mon){
if(_birth_dat <= _today_dat){_adjust=0;}
if(_birth_dat > _today_dat){_adjust=-1;}}
if(_birth_mon < _today_mon){_adjust=0;}
/* 2000年問題対応 */
if(_birth_year < 2000){_birth_year=_birth_year+1900}
/* 結果 */
var _old= _today_year-_birth_year+_adjust;
/* 出力 */
document.write(_old);
}
</SCRIPT>
|