• 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

    • WWDC 2025: Apple AirPods gain new remote control feature on iPhone and iPad by Aditya Tiwari Apple's annual developer event, WWDC 2025, is now up and running. Alongside the much-hyped Liquid Glass design for its software ecosystem, the Cupertino giant introduced new features for its wireless headphones. The AirPods Pro 2, AirPods 4, and AirPods 4 with Active Noise Cancellation (ANC) are being updated with studio-quality audio recording capabilities. Building on the Voice Isolation feature from last year, it allows users and content creators to record their content with greater sound quality. Apple has also improved voice call quality on these AirPods models to add "more natural vocal texture and clarity" when using FaceTime, CallKit-enabled apps, and regular phone calls. Meanwhile, the upgraded audio recording capabilities work across the Camera app, Voice Memos, dictation in Messages, video conferencing apps like Webex, and compatible third-party camera apps. You have already been able to use your Apple Watch as a wireless remote for your iPhone's camera. This capability is now available on AirPods Pro 2, AirPods 4, and AirPods 4 ANC. You can press and hold the stem of your AirPods to snap a photo or start and stop video recording. Apple AirPods already support head gestures when responding to the Siri voice assistant. You can nod your head to say yes or shake it horizontally to say no when responding to the virtual assistant. Now, you can also use your AirPods to capture content from a distance. "For users who like capturing themselves singing or dancing, the new features make it easy to perform in sync with a soundtrack while simultaneously recording the video," Apple said. The camera remote feature on AirPods works with the Camera app or supported third-party camera apps on your iPhone or iPad. These new AirPods features are now available for testing through the Apple Developer Program and will be offered through public beta next month. Their public rollout will happen later this year through a firmware update shipped alongside iOS 26, iPadOS 26, and macOS Tahoe 26.
    • Anyone remembers times when Apple already had everything glassy looking? I do and I didn't even use Apple products back then...
    • This app has become so bloated. I just want to see my money, send and receive it. Not offers and recommendations.
    • >it will be hiring 1,250 operators, technicians, and engineers to help manage the facilities Um, that's chump change employment numbers for any sector. Any word on what the cost will be to PA for "securing" this investment?! How much do the PA taxpayers have to eat?
  • Recent Achievements

    • Rookie
      CHUNWEI went up a rank
      Rookie
    • Enthusiast
      the420kid went up a rank
      Enthusiast
    • Conversation Starter
      NeoToad777 earned a badge
      Conversation Starter
    • Week One Done
      VicByrd earned a badge
      Week One Done
    • Reacting Well
      NeoToad777 earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      480
    2. 2
      +FloatingFatMan
      281
    3. 3
      ATLien_0
      255
    4. 4
      Edouard
      204
    5. 5
      snowy owl
      201
  • Tell a friend

    Love Neowin? Tell a friend!