...

View Full Version : logo image changing on refresh



1234m
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

hotmks
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.



-----------------------------------------
http://www.buceshi.com

hdewantara
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">
var
total_images=5;

function rand_logof(){
var
a=Math.floor(total_images*Math.random());
document.getElementById("logo").src="logo"+a+".jpg";
}

</script>
</head>

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

Bar2aYunie
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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum