34 lines
950 B
JavaScript
34 lines
950 B
JavaScript
function changeGreeting() {
|
|
const greeting = document.getElementById("greeting");
|
|
const hour = new Date().getHours();
|
|
|
|
if (hour < 12) {
|
|
greeting.textContent = "Guten Morgen und willkommen!";
|
|
} else if (hour < 18) {
|
|
greeting.textContent = "Guten Tag und schön, dass du da bist!";
|
|
} else {
|
|
greeting.textContent = "Guten Abend und viel Spass hier!";
|
|
}
|
|
}
|
|
|
|
function changeBackground() {
|
|
const colors = [
|
|
"linear-gradient(135deg, #74ebd5, #9face6)",
|
|
"linear-gradient(135deg, #ff9a9e, #fad0c4)",
|
|
"linear-gradient(135deg, #a18cd1, #fbc2eb)",
|
|
"linear-gradient(135deg, #f6d365, #fda085)"
|
|
];
|
|
|
|
const randomColor = colors[Math.floor(Math.random() * colors.length)];
|
|
document.body.style.background = randomColor;
|
|
}
|
|
|
|
function toggleText() {
|
|
const text = document.getElementById("fun-text");
|
|
|
|
if (text.style.display === "none") {
|
|
text.style.display = "block";
|
|
} else {
|
|
text.style.display = "none";
|
|
}
|
|
} |