Date
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Functions</h1>
<p>This example calls a function which performs a calculation, and returns the result:</p>
<input type=input id="p1">
<input type=button onclick="myFunction()" value="C to F">
<input type=button onclick="yourFunction()" value="F to C">
<p id="demo"></p>
<script>
function myFunction() {
var p1= document.getElementById("p1").value;
var today =new Date();
var birthday = new Date();
birthday.setFullYear(p1);
document.getElementById("demo").innerHTML =
(birthday-today)/1000/60/60/24;
}
function yourFunction() {
var p1= document.getElementById("p1").value;
document.getElementById("demo").innerHTML = (p1-32)*5/9;
}
</script>
</body>
</html>