You could use scripting - either server-side or Javascript - to display a random image each time the page is loaded. Tracking the number of times each particular IP address owner visits your site and displaying a particular sequence of images is probably more trouble than it's worth.
A javascript something like this should do the trick:
[tt]
var theImages = new Array()
Images[0] = '1.gif'
Images[1] = '2.gif'
Images[2] = '3.gif'
Images[3] = '4.gif'
//add more images here ...
function showImage(){
var Pick = Math.round(Math.random()*(Images.length-1));
document.write('<img src="'+Images[Pick]+'" />');
}
[/tt]
Actually, I had another look at the script I'm using (to present a random quote, not a picture, but the principle's the same). It's slightly different...
Put the following in a file on its own. Call it, say, "showpic.js":
[tt]
var theImages = new Array()
Images[0] = '1.gif'
Images[1] = '2.gif'
Images[2] = '3.gif'
Images[3] = '4.gif'
//add more images here ...
var Pick = Math.round(Math.random()*(Images.length-1));
document.write('<img src="'+Images[Pick]+'" />');
[/tt]
Now, on the web page where you want the image to appear, put this instead:
[tt]
<script language="JavaScript" src="showpic.js" type="text/javascript"></script>
[/tt]
I'm not a JavaScript expert, and haven't tested this, but it should do the trick for most people. You can see my random quote version in action at
The advantages of using JS to do the randomising at the browser end are that it's (relatively) simple, possible on freebie hosts as well as paid ones, and the random images won't be cached - ensuring that you get a fresh roll of the dice each time you load the page.
The disadvantage is that people who surf with JS switched off (for whatever reason) will not see your images - the script will be ignored. If you want to be sure your images show up, you'll need to use some kind of server-side scripting. Here's a link to some perl scripts, there's also some remotely hosted services there if you don't have your own cgi-bin...
My McGonagall site uses Javascript for the (eye-candy) quote at the top of each page, but server-side script for the (vital) "Gem of the Day" on certain pages.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.