We have some websites where we would like to have a different, random header image on various pages and maybe even various random images in different areas of the website.
We found this bit of code that worked great, although it doesn’t use CSS, but a simple bit of PHP code. Here it is:
<img src=”http://www.yoursite.com/directory-for-your-header-images/header_<?php echo(rand(1,5)); ?>.jpg”
width=”1024″ height=”300″ alt=”automotive tools and power tools” />
Of course, you’re going to enter all your own data and variables, but surely you get the picture.
It’s that simple, place that code wherever you want your random image and there you go.
