<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
</head>
<body>
<h1>Age Calculator</h1>
Enter your birth year <input type="text" id="birth"> <br><br>
Enter your current year <input type="text" id="current"> <br><br>
<button onclick="Age()">Generate Age</button>
<p id="ans"></p>
</body>
<script>
function Age() {
var b=document.getElementById("birth").value
var c=document.getElementById("current").value
var final=c-b
document.getElementById("ans").innerHTML="your age is :"+final
}
</script>
</html>
No comments:
Post a Comment