View Full Version : logo image changing on refresh

12-23-2009, 04:52 PM
i was wondering if there is a code that any of you know that if i have different multiple images of my logo and everytime someone refreshes the page it changes randomly to one of the images everytime? Can this be done with javascript and if so could you please pass on the code, or could this be done with something like css or html? I don't see either css or html doingthat but maybe im missing something

thank you

12-26-2009, 01:55 PM
In my opion,it is unrealistic if you wanna process in client side.

suggest you process on server side.


01-01-2010, 08:15 PM
Probably you want it like below?
I haven't tested yet,
but you should rename the files to
logo1.jpg, logo2.jpg, ... up to logo4.jpg
(see the total_images variable)

<script type="text/javascript">

function rand_logof(){


<body onload="rand_logof();">
<img id="logo" src="" />

01-01-2010, 10:00 PM
I've searched a script like this before and I found this one (was still amoung my favorites lol). I actually didn't use it in the end, but maybe it's useful for you.

Note: it's not mine, just pointing out where you might find it.

Ranom Image Script (http://www.phpjunkyard.com/random-image.php)

If the above example isn't useful or exactly what you want, maybe this'll do it!