Update index.html
Browse files- index.html +49 -18
index.html
CHANGED
|
@@ -1,19 +1,50 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>Date and Ages</title>
|
| 6 |
+
<style>
|
| 7 |
+
body { font-family: Arial, sans-serif; padding: 20px; }
|
| 8 |
+
#time { font-weight: bold; margin-bottom: 20px; }
|
| 9 |
+
ul { list-style-type: none; padding: 0; }
|
| 10 |
+
li { margin: 5px 0; }
|
| 11 |
+
.age { color: blue; margin-right: 5px; }
|
| 12 |
+
.month { color: green; margin-right: 2px; }
|
| 13 |
+
.day { color: orange; }
|
| 14 |
+
</style>
|
| 15 |
+
</head>
|
| 16 |
+
<body>
|
| 17 |
+
|
| 18 |
+
<div id="time"></div>
|
| 19 |
+
<ul id="ageList"></ul>
|
| 20 |
+
|
| 21 |
+
<script>
|
| 22 |
+
// Show current time
|
| 23 |
+
function updateTime() {
|
| 24 |
+
const now = new Date();
|
| 25 |
+
const timeString = now.toLocaleTimeString();
|
| 26 |
+
document.getElementById("time").textContent = "Current time: " + timeString;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
updateTime();
|
| 30 |
+
setInterval(updateTime, 1000); // Update every second
|
| 31 |
+
|
| 32 |
+
// Get tomorrow + 8 days
|
| 33 |
+
const targetDate = new Date();
|
| 34 |
+
targetDate.setDate(targetDate.getDate() + 9);
|
| 35 |
+
|
| 36 |
+
const month = targetDate.toLocaleString('default', { month: 'short' }); // "Apr"
|
| 37 |
+
const day = String(targetDate.getDate()); // "19"
|
| 38 |
+
|
| 39 |
+
const ages = [22, 25, 30];
|
| 40 |
+
const ul = document.getElementById("ageList");
|
| 41 |
+
|
| 42 |
+
ages.forEach(age => {
|
| 43 |
+
const li = document.createElement("li");
|
| 44 |
+
li.innerHTML = `<span class='age'>${age}</span><span class='month'>${month}</span> <span class='day'>${day}</span>`;
|
| 45 |
+
ul.appendChild(li);
|
| 46 |
+
});
|
| 47 |
+
</script>
|
| 48 |
+
|
| 49 |
+
</body>
|
| 50 |
</html>
|