Last active
September 27, 2020 02:34
-
-
Save Ashvith07/2ac14586d2763074827e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title> The Age Calculator</title> | |
</head> | |
<body> | |
<script language="JavaScript"> | |
function CalculateAge() | |
{ | |
var birthyear = document.form1.txt.value; | |
var currentyear = new Date(); | |
var age = currentyear.getFullYear(); | |
document.write('They are either ' + (age-birthyear)+ ' or ' + (age-birthyear - 1)); | |
} | |
</script> | |
<form name=form1> | |
Enter the Birth Year | |
<input type="text" name="txt" size=10> | |
<br> | |
<input type="button" value="Calculate" onClick='CalculateAge();'> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment