This assignment wanted us to let the user type the birthdate into a form and click on a button. Then the page should tell about the current date and how old the user is now just in time. Also there should be an alert window if the entered date isnt correct.

This is what I came up with my work.

 

mm/dd/yy

As I was wondering if there is a solution that the result is showed inside this page and not like here by opening a new page I talked to a friend about and he found a solution. In this part of the script:

<!-- Writing the values

document.write ("<CENTER><FONT size=4>Right Now It Is: " + todaysTime +

" (On your computer)</FONT>");

document.write ("<CENTER><FONT size=4>Specified Birthday Is: " +

birthTime + " (Adjusted for your timezone)</FONT>");

document.write ("<CENTER><FONT color=green size=5>That Makes The Age : " +

diffYear + " Years, " + diffMonth + " Months, " + diffDate + " Days, " +

diffHour + " Hours, " + diffMinute +" Minutes, " + todaysSecond +

" Seconds Old!!! (In ALL time zones)</FONT>");


one has to change the script to the following:

<!-- Writing the values

boa="<FONT size=2>On your computer now is: " + todaysTime + 
"</FONT><br>";
boa=boa+"<FONT size=2>The Birthday is: " + 
birthTime + "</FONT><br>";
boa=boa+"<FONT color=white size=2>The age is: " + 
diffYear + " Years, " + diffMonth + " Months, " + diffDate + " Days, " + 
diffHour + " Hours, " + diffMinute +" Minutes, " + todaysSecond + 
" Seconds Old!!!</FONT><br><br>";
boa=boa+"<FONT color=red size=1>Click this frame to close it</font>"
board.innerHTML=boa
board.style.visibility="visible";

 

and inside the body tag:

<div id=board style="visibility:hidden;position:absolute;bottom:10;left:20;background-color:teal;z-index:20;BORDER-RIGHT: #774500 2px inset;BORDER-TOP:gold 1px outset;BORDER-LEFT:gold 1px outset;BORDER-BOTTOM:#774500 2px inset;padding-left:15;padding-right:15;padding-top:20;padding-bottom:10;cursor:hand;" onclick="this.style.visibility='hidden'"></div>

Here you can look at the final result

 

back