Update index.html
Browse files- index.html +22 -18
index.html
CHANGED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<title>Future
|
| 6 |
<style>
|
| 7 |
body { font-family: sans-serif; padding: 20px; }
|
| 8 |
ul { list-style-type: none; padding: 0; }
|
| 9 |
-
li { margin:
|
| 10 |
.age { font-weight: bold; color: #333; margin-right: 10px; }
|
| 11 |
.month { color: #0077cc; margin-right: 5px; }
|
| 12 |
.day { color: #cc5500; }
|
|
@@ -14,29 +14,33 @@
|
|
| 14 |
</head>
|
| 15 |
<body>
|
| 16 |
|
| 17 |
-
<ul id="
|
| 18 |
-
<!--
|
| 19 |
</ul>
|
| 20 |
|
| 21 |
<script>
|
| 22 |
-
const offsets = [8, 15, 30];
|
| 23 |
-
const
|
|
|
|
| 24 |
|
| 25 |
offsets.forEach(offset => {
|
| 26 |
-
const
|
| 27 |
-
|
| 28 |
|
| 29 |
-
const month =
|
| 30 |
-
const day =
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
});
|
| 41 |
</script>
|
| 42 |
|
|
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>Future Birthdays</title>
|
| 6 |
<style>
|
| 7 |
body { font-family: sans-serif; padding: 20px; }
|
| 8 |
ul { list-style-type: none; padding: 0; }
|
| 9 |
+
li { margin: 8px 0; padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; width: fit-content; }
|
| 10 |
.age { font-weight: bold; color: #333; margin-right: 10px; }
|
| 11 |
.month { color: #0077cc; margin-right: 5px; }
|
| 12 |
.day { color: #cc5500; }
|
|
|
|
| 14 |
</head>
|
| 15 |
<body>
|
| 16 |
|
| 17 |
+
<ul id="birthday-list">
|
| 18 |
+
<!-- Populated by script -->
|
| 19 |
</ul>
|
| 20 |
|
| 21 |
<script>
|
| 22 |
+
const offsets = [8, 15, 30];
|
| 23 |
+
const ages = [22, 25, 30];
|
| 24 |
+
const ul = document.getElementById("birthday-list");
|
| 25 |
|
| 26 |
offsets.forEach(offset => {
|
| 27 |
+
const date = new Date();
|
| 28 |
+
date.setDate(date.getDate() + offset);
|
| 29 |
|
| 30 |
+
const month = date.toLocaleString('default', { month: 'short' });
|
| 31 |
+
const day = date.getDate();
|
| 32 |
|
| 33 |
+
ages.forEach(age => {
|
| 34 |
+
const li = document.createElement('li');
|
| 35 |
+
li.setAttribute('data-offset', offset);
|
| 36 |
+
li.setAttribute('data-age', age);
|
| 37 |
+
li.innerHTML = `
|
| 38 |
+
<span class="age">${age}</span>
|
| 39 |
+
<span class="month">${month}</span>
|
| 40 |
+
<span class="day">${day}</span>
|
| 41 |
+
`;
|
| 42 |
+
ul.appendChild(li);
|
| 43 |
+
});
|
| 44 |
});
|
| 45 |
</script>
|
| 46 |
|