ASDV-WebDev/Semester 1/Chapter ZIPs/JavaScript/ch7/ex_7_13.html

23 lines
746 B
HTML

2023-03-30 13:50:50 +07:00
<html>
<head>
<title>Example 7.13</title>
<script>
function begin()
{
var now = new Date(); var before = new Date(); var later = new Date();
before.setFullYear(1812, 2, 3);
later.setFullYear(2095,6,15);
document.getElementById('now').innerHTML = ("Today's date: " + now);
document.getElementById('before').innerHTML = ("In the past it was: " + before);
document.getElementById('later').innerHTML = ("One day it will be: " + later);
}
</script>
</head>
<body><table align="center" width = "70%"><tr><td><br />
<input type ="button" onclick="begin()" value = "Does anyone know what day it is?"><br />
<h3><span id = "now">&nbsp;</span></h3>
<h3><span id = "before">&nbsp;</span></h3>
<h3><span id = "later">&nbsp;</span></h3>
</body>
</html>