<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Images</title>
<style>
/* Add some basic CSS styles for the images */
.image-container {
display: flex;
flex-wrap: wrap;
}
.image {
width: 150px;
height: 150px;
margin: 10px;
object-fit: cover;
}
</style>
</head>
<body>
<h1>Random Images</h1>
<div class="image-container" id="image-container">
<!-- Images will be displayed here using JavaScript -->
</div>
<script>
// An array of image URLs
const imageUrls = [
"https://i.postimg.cc/8kX4hW8d/Gradient-BGHM.webp",
"https://i.postimg.cc/MHnYG8TQ/Profile.png",
"https://i.postimg.cc/GhMVyDG0/Screenshot-250.png",
"https://i.postimg.cc/9QYyyyfP/POMSD-PRESS-C.gif",
"https://i.postimg.cc/6qMxJTvR/Meg-2-Helpsmovies-SS-4.png"
// Add more image URLs as needed
];
// Function to display random images
function displayRandomImages() {
const imageContainer = document.getElementById("image-container");
imageContainer.innerHTML = ""; // Clear previous images
// Shuffle the array to get a random order
const shuffledImageUrls = imageUrls.sort(() => Math.random() - 0.5);
// Create and display image elements
shuffledImageUrls.forEach(imageUrl => {
const image = document.createElement("img");
image.src = imageUrl;
image.alt = "Random Image";
image.className = "image";
imageContainer.appendChild(image);
});
}
// Call the function to display random images when the page loads
window.addEventListener("load", displayRandomImages);
</script>
</body>
</html>
Contact Us!
0 Comments
type your comment...