View Single Post
Old 06-27-2008, 01:46 PM  
AnniKN
Confirmed User
 
AnniKN's Avatar
 
Industry Role:
Join Date: Feb 2008
Location: South of the border
Posts: 1,682
Sorry for the delay! Lunch break and then took forever to write this!

Here's the script:

Code:
<? 
 $randomNum = rand (1,3);
 $img1 = "sponsor1.jpg";
 $img2 = "sponsor2.jpg";
 $img3 = "sponsor3.jpg"; 
 $image = ${'img'.$randomNum};
  Print "<img src=".$image.">";
?>
Working here: http://www.freepr0nz.com/gfy/test.php

I didn't create this, my bf got it somewhere but it's quite easy to customize which is great you can use it even to rotate banners or I'm using it to show different POTDs of different sites in my blog (that just went down due to a GoDaddy fuckup! redirecting to plesk? WTF!)

You can add more fields and more images and whatnot To add more pictures just add additional "$img#" rows and change the number in the "rand (1,3)" bit for the number you have available

I also have one that when you hover goes through the pictures (think the preview function on Redtube) Code for that:

Code:
<html>
<head>
<script type='text/javascript' src='thumbchange.js'>
</script>
</head>
<body>

<script type='text/javascript'>
stat['sponsor1']=0; pic['sponsor1']=new Array(); pics['sponsor1']=new Array(1,1,1);</script>

<a href="niche.html"><img id="sponsor1" src="sponsor1_001.jpg"  onmouseout='endm("sponsor1"); this.src="sponsor1_001.jpg"; ' onmouseover='startm("sponsor1","sponsor1_",".jpg"); '></a>

</body>
</html>
Repeat the bit within the body for every niche - the part that says (1,1,1) has to be extended to the amount of pics you have for said sponsor... you can see a working sample here:

http://www.freepr0nz.com/gfy/hover/

And you can download the .js here:

http://www.freepr0nz.com/gfy/hover/thumbchange.js

cheers!
AnniKN is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote