Begrüßung nach Tageszeit

This commit is contained in:
lena_smd02 2026-07-01 12:34:51 +02:00
parent 9f9d3c4969
commit b1c4568ca1
2 changed files with 14 additions and 1 deletions

View file

@ -9,7 +9,7 @@
<!-- Erste Änderung aus VS Code -->
</head>
<body>
<p id="begruessung"></p>
<nav>
<ul>
<li><a href="index.html">Home</a></li>

View file

@ -40,3 +40,16 @@ document.querySelectorAll('.galerie img').forEach(img => {
document.body.appendChild(overlay);
});
});
// Begruessung nach Tageszeit
const stunde = new Date().getHours();
let text;
if (stunde < 10) {
text = "Guten Morgen!";
} else if (stunde < 18) {
text = "Hallo, schön dass du da bist!";
} else {
text = "Guten Abend!";
}
document.getElementById("begruessung").textContent = text;