Náhodný obrázek
<!DOCTYPE html>
<html lang=“cs“>
<head>
<meta charset=“UTF-8″>
<meta name=“viewport“ content=“width=device-width, initial-scale=1.0″>
<title>Náhodné zobrazení fotek</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 20px;
}
img {
max-width: 100%;
height: auto;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Náhodná fotka z adresáře /novinky</h1>
<img id=“randomImage“ src=““ alt=“Náhodná fotka“>
<script>
// Seznam souborů v adresáři /novinky
const images = [
„novinky/image1.jpg“,
„novinky/image2.jpg“,
„novinky/image3.jpg“,
„novinky/image4.jpg“,
„novinky/image5.jpg“
];
function getRandomImage() {
const randomIndex = Math.floor(Math.random() * images.length);
document.getElementById(„randomImage“).src = images[randomIndex];
}
window.onload = getRandomImage;
</script>
</body>
</html>








