I'm wondering if anyone has any experience with rotating a couple of different images in the same spot, with the same link (basically rotating between 2-3 different logos) each time the page is loaded. I've seen a java script out there for rotating ads, but I couldn't get it to work for some reason, and I've seen one that flips through pictures at a time interval, but not just when the page refreshes. Thanks. Toonces51
Here is what I use, it is in PHP. Just replace those iframe's with your images, save the file as filename.php then in the page that you want it to appear put <? include("filename.php") ?> here is the code to put in filename.php: <? $codes = array( "<iframe src=\"http://rcm.amazon.com/e/cm?t=mattmartigrap-20&o=1&p=8&l=as1&asins=6304474350&fc1=000000&=1&lc1=0000ff&bc1=000000<1=_blank&IS2=1&f=ifr&bg1=ffffff&f=ifr\" width=\"120\" height=\"240\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"> </iframe>", "<iframe src=\"http://rcm.amazon.com/e/cm?t=mattmartigrap-20&o=1&p=8&l=as1&asins=0816039259&fc1=000000&=1&lc1=0000ff&bc1=000000<1=_blank&IS2=1&f=ifr&bg1=ffffff&f=ifr\" width=\"120\" height=\"240\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"> </iframe>", "<iframe src=\"http://rcm.amazon.com/e/cm?t=mattmartigrap-20&o=1&p=8&l=as1&asins=B00005MOYU&fc1=000000&=1&lc1=0000ff&bc1=000000<1=_blank&IS2=1&f=ifr&bg1=ffffff&f=ifr\" width=\"120\" height=\"240\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"> </iframe>", "<iframe src=\"http://rcm.amazon.com/e/cm?t=mattmartigrap-20&o=1&p=8&l=as1&asins=B000000JU9&fc1=000000&=1&lc1=0000ff&bc1=000000<1=_blank&IS2=1&f=ifr&bg1=ffffff&f=ifr\" width=\"120\" height=\"240\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"> </iframe>", "<iframe src=\"http://rcm.amazon.com/e/cm?t=mattmartigrap-20&o=1&p=8&l=as1&asins=B0007NE894&fc1=000000&=1&lc1=0000ff&bc1=000000<1=_blank&IS2=1&f=ifr&bg1=ffffff&f=ifr\" width=\"120\" height=\"240\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\"> </iframe>" ); shuffle($codes); $i=0; $number=1; while(list(, $code) = each($codes)) { if ($i>=$number) { break; } echo "$code"; echo '<br>'; $i++; } ?>
Cool! I could use this for OW! ...uh I could change this a little and HEY!! This is similar to a random quote I use on ooof!! Quit kicking me man!!!
I use this and it works very well: <script language="JavaScript"> images = new Array(3); images[0] = "<a href = 'xxxxx'><img src='xxxx1.jpg' alt='xxxx'><br><b>text if needed</a>"; images[1] = "<a href = 'xxxxx'><img src='xxxx2.jpg' alt='xxxx'><br><b>text if needed</a>"; images[2] = "<a href = 'xxxxx'><img src='xxxx3.jpg' alt='xxxx'><br><b>text if needed</a>"; index = Math.floor(Math.random() * images.length); document.write("<DL>\n"); document.write("<DT>" + "" + images[index] + "\n"); document.write("</DL>\n"); </script> Code (markup): You can add unlimited pictures to rotate, but don't forget to change the newarray(x) value.
Thanks to both mattmdesign and roman1 for their help. I ended up using the Javascript just because I'm a little more familiar with that--I might try out the PHP version at some point too (seems to me I'll have plenty of uses for this code). Toonces51
If it is only a three logo's would it not be a simpler idea to create an animated gif? That way if you minimalise the amount of code in the document? The PHP technique is great, try and remember to use ampersands in the URL's for validation purposes.
I would have done an animated gif, but I didn't want to logo to actually rotate on while they were on the page--I just wanted there to be a different logo as they click thru to different pages of the site. Toonces51