Your website might have some cool pictures that you want to show on
your opening page . If it's just one or two, you'd just put them on there
as fixed images, but sometimes you have more than that. Rather than
choose just the best one, you might arrange to have all of them shown,
one at a time, in what's called a slideshow
or carousel
. As with many of our JavaScript applications, there
are many examples, plugins and tutorials on the web that do the job. Our
implementation is simpler and less sophisticated than those, but we
think it's good enough.
Often, you want to display a beautiful, decorative picture on your site, but maybe you have several and you don't want to choose among them, or you don't want to always show the same picture. One possibility is to have the page show a random picture, so that the site isn't always the same.
Below is a picture randomly drawn from a small set of four pictures. If you reload this page, there's only a 25% chance that you'll see the same picture. Try it!
Because the picture is only decorative, we haven't given it a caption, though of course we could.
Use view source
on this page to see exactly how we did
it.
See the reading on random images for more explanation.