Professional Documents
Culture Documents
Randomimage
Randomimage
DOCTYPE html>
<html>
<head>
<title>Random Images</title>
<style>
/* Add some basic styling to the page */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
img {
display: block;
margin: 20px auto;
max-width: 80%;
height: auto;
}
</style>
</head>
<body>
<h1>Random Images</h1>
<p>Click the button to display a new random image:</p>
<button onclick="displayRandomImage()">Show me a random image</button>
<div id="image-container"></div>
<script>
// Define an array of image URLs
const images = [
'https://picsum.photos/id/237/300/200',
'https://picsum.photos/id/238/300/200',
'https://picsum.photos/id/239/300/200',
'https://picsum.photos/id/240/300/200',
'https://picsum.photos/id/241/300/200',
'https://picsum.photos/id/242/300/200',
'https://picsum.photos/id/243/300/200',
'https://picsum.photos/id/244/300/200',
'https://picsum.photos/id/245/300/200',
'https://picsum.photos/id/246/300/200'
];
// Set the source of the image element to the random image URL
imageElement.src = imageUrl;