• 0

Needed: Rotating Banner/Image Script


Question

10 answers to this question

Recommended Posts

  • 0

here is a very simple javascript one:

<script language="javascript">

var images = new Array(5)

var links = new Array(5)

images[0] = '0.gif';

links[0] = 'http://www.yahoo.com';

images[1] = '1.gif';

links[1] = 'http://www.google.com';

images[2] = '2.gif';

links[2] = 'http://www.cnet.com';

images[3] = '3.gif';

links[3] = 'http://www.wired.com';

images[4] = '4.gif';

links[4] = 'http://www.miniclip.com';

var i = Math.round(Math.random()*4)

document.write('<a' + links + '"><img border=0 src="' + images + '">');

</script>

  • 0
  RobertH said:
CJ Ad Rotator V1.0

http://www.cj-design.com/index.php?content=downloads&page=6

:yes: Funny i was just looking at this when i saw your thread lol.

584768198[/snapback]

  deadlogics said:
here is a very simple javascript one:

<script language="javascript">

var images = new Array(5)

var links = new Array(5)

images[0] = '0.gif';

links[0] = 'http://www.yahoo.com';

images[1] = '1.gif';

links[1] = 'http://www.google.com';

images[2] = '2.gif';

links[2] = 'http://www.cnet.com';

images[3] = '3.gif';

links[3] = 'http://www.wired.com';

images[4] = '4.gif';

links[4] = 'http://www.miniclip.com';

var i = Math.round(Math.random()*4)

document.write('<a' + links + '"><img border=0 src="' + images + '">');

</script>

584769491[/snapback]

Thanks guys. Will try both sometime later. :yes:

  • 0

Here's what I got but it doesn't seem to work:

&lt;?php
    include("/randomimage.php"); 
    ?&gt;

&lt;?php
$total = "2";
$file_type = ".gif";
$image_folder = "/banners/";
$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
echo '&lt;img src="https://www.tennesseedubs.com/v3/banners/'.$image_name/&gt;';
?&gt;

Link

I don't know what's up. Any insight would be great. Thanks.

  • 0

When in doubt, pick the easiest. Here is an easier version of the ones above.

&lt;script&gt;
var i=-1;
var banner=new Array();
banner[i++]='Banner 0 Code';
banner[i++]='Banner 1 Code';
banner[i++]='Banner 2 Code';
banner[i++]='Banner 3 Code';
var whichbanner=Math.floor(Math.random()*(banner.length));
document.write(banner[whichbanner]);
&lt;/script&gt;

-Ian

(You can reorder them and create infinite more without needing a number scheme.)

  • 0
  eeban said:
When in doubt, pick the easiest.  Here is an easier version of the ones above.

&lt;script&gt;
var i=-1;
var banner=new Array();
banner[i++]='Banner 0 Code';
banner[i++]='Banner 1 Code';
banner[i++]='Banner 2 Code';
banner[i++]='Banner 3 Code';
var whichbanner=Math.floor(Math.random()*(banner.length));
document.write(banner[whichbanner]);
&lt;/script&gt;

-Ian

(You can reorder them and create infinite more without needing a number scheme.)

584786583[/snapback]

Would you care to break that down some more? For instance, what goes in [i++] or what code goes in between 'Banner # Code'? Thanks.

  • 0
  San Diego said:
Would you care to break that down some more? For instance, what goes in [i++] or what code goes in between 'Banner # Code'? Thanks.

584787671[/snapback]

Yes i am also interested, i want to know the easiest way to have rotating images.

P.S. Sorry for bumping an old thread. But You cant win though, you make a new topic and you get flamed and told to search, you post in an old one and it gets closed :/

What is one to do?

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Doesn't that assume that there is only one potential use-case scenario when in fact there are millions of people who live in urban areas that only require a small fraction of that?
    • Google Chrome is ending support for two ancient versions of Android by Usama Jawad Google Chrome is the most used browser right now, with the competition trailing far behind. What browser you use typically ends up being a matter of preference and familiarity, but all vendors are trying to one-up each other as they vy for more market share. Recently, Google claimed that Chrome is now faster than ever while Microsoft boasted that Edge is better at ad-blocking than Google's offering. Regardless of all these factors, Chrome commands a significant market share, even on legacy systems. Now, Google has announced that it is ending support for Chrome on two legacy versions of Android. In a brief blog post, Google has announced that it is dropping support for Chrome on Android 8 Oreo and Android 9 Pie with the upcoming version 139 of the browser expected to release on August 5. Right now, the current stable version of Chrome is 137, which means that Chrome 138 will be the last version of the browser to support these legacy operating systems. In practice, this means that Chrome will require Android 10.0 or above on mobile platforms in order to receive further updates. While the browser will continue working on older versions of Android, they will not receive updates, which means that they'll be left insecure and vulnerable to cybersecurity threats. As expected, Google has recommended that users on older systems should migrate to at least Android 10 in order to continue receiving updates on Chrome. While the company hasn't explicitly stated a reason behind its decision, it likely has to do with the dwindling user base of these old versions of Android and Google's ambitions to get more people to upgrade to newer versions of its mobile operating system. It's important to note that Android 8 was released in August 2017 and received its final security patch in October 2021. Meanwhile, Android 9 was rolled out to the public in August 2019 and netted its final update in January 2022. So in retrospect, Google has already been offering Chrome support for these legacy versions long after they hit end-of-support themselves.
    • I use two of these in RAID0 for video games and other things, together they are capable of 2.8 million IOPS and 15 GB/s on Gen4. At this price, 4 TB of Gen4 is faster and less expensive than a single 2 TB Gen5 NVMe, not to mention easier to cool off. Highly recommend.
    • that is a normal sign in, they just put in a dumb location to try to hide it... and yes I think the whole MS account by default is BS too, the first question should be do you want an online profile or a local one
    • From our past comments, it looks like some ppl are defo enjoying these stories.
  • Recent Achievements

    • One Month Later
      adnan.hebibovic earned a badge
      One Month Later
    • Week One Done
      adnan.hebibovic earned a badge
      Week One Done
    • Dedicated
      tesla maxwell earned a badge
      Dedicated
    • Dedicated
      Camlann earned a badge
      Dedicated
    • Week One Done
      fredss earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      629
    2. 2
      Michael Scrip
      224
    3. 3
      ATLien_0
      219
    4. 4
      +FloatingFatMan
      143
    5. 5
      Xenon
      134
  • Tell a friend

    Love Neowin? Tell a friend!