Log in

View Full Version : Rotating Header Image?


twm1010
01-20-2009, 10:23 AM
I would like the header image for my website to automatically rotate each time the page is refreshed, and that's all I need it to do.

I searched and searched but most of the rotating modifications seem to be geared towards advertising and its mind boggling on which one is the best application for what I need here. If all else fails I'll just try one after the next, but I thought perhaps its easiest to ask, which one should I use?

Thanks,
Tom

flup
01-20-2009, 10:41 AM
Could be pretty simple though, in your header template look up the place where the header image is set:

<img src="$stylevar[titleimage]" border="0" alt="$vboptions" />

And replace that with a random javascript image display code, like this one:

<script language="JavaScript">

function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish, upload these in your root images folder
[B] myimages[1]="img1.gif"
myimages[2]="img2.gif"
myimages[3]="img3.gif"

var ry=Math.floor(Math.random()*myimages.length)

if (ry==0)
ry=1
document.write('<img src="images/'+myimages[ry]+'" border=0>')
}

random_imglink()
//-->
</script>

Guess that?ll do the job for you

odln018
05-01-2009, 12:47 PM
I can confirm that this works well.

Thank you!