Begrüßung nach Tageszeit
This commit is contained in:
parent
9f9d3c4969
commit
b1c4568ca1
2 changed files with 14 additions and 1 deletions
|
|
@ -9,7 +9,7 @@
|
||||||
<!-- Erste Änderung aus VS Code -->
|
<!-- Erste Änderung aus VS Code -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<p id="begruessung"></p>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="index.html">Home</a></li>
|
<li><a href="index.html">Home</a></li>
|
||||||
|
|
|
||||||
13
js/script.js
13
js/script.js
|
|
@ -40,3 +40,16 @@ document.querySelectorAll('.galerie img').forEach(img => {
|
||||||
document.body.appendChild(overlay);
|
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;
|
||||||
Loading…
Reference in a new issue