• 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

    • This was cool back in the day when done properly - loved having icons of specific devices.
    • Microsoft quietly burying a massive Windows 7 hardware driver feature as Windows 11 kills it by Sayan Sen Last month Microsoft announced a big update for Windows hardware drivers. The company declared that it was killing Windows Device metadata and the Windows Metadata and Internet Services (WMIS). For those wondering what it is, device metadata, as the name suggests, is the collection of additional, user-facing information that an original equipment manufacturer (OEM) provides about a hardware device. The feature was introduced with Windows 7 and can include stuff like icons, logos, descriptive texts, among other things, that help the Windows UI display details about such devices in places like Task Manager or Device Manager. This was a huge deal back in the day when Windows 7 debuted. The company called the feature "Device Stage" and Microsoft described it as a "new visual interface" that essentially worked like a "multi-function version of Autoplay where it displays all the applications, services, and information related to your device." It is often considered synonymous with the Windows "Devices and Printers" Control Panel applet. Neowin did an in-depth overview of the feature when it first launched which you can find in its dedicated article here. The Windows OS was able to obtain the device experience metadata from the WMIS, but now that the feature is being deprecated, Microsoft has begun removing information about Device Stage from its official support documents. Neowin noticed while browsing that a support article regarding automatic Windows hardware drivers was updated for Windows 11 and 10 sometime last year after the release of Windows 11 24H2. Previously, this article was geared for Windows 7 and was much longer. It also contained information about Device Stage, which, as mentioned above, was a headlining feature on Windows 7. In the said article, the section "If Windows can't find information about your device in Device Stage" has been deleted. You can find the archived version of the support page here. Aside from shortening the amount of information on the page, Microsoft has also added some more details on it. The company has now tried to define what the Microsoft Basic Display Adapter is, how updating drivers through Device Manager works, as well as a thorough and detailed troubleshooting section for common hardware driver errors on Windows, including one for USB-C. You can find all the new details on the updated support page here on Microsoft's website.
    • Sounds creepy to say the least. Don't need nor want AI having access to my history. They're claiming it to be an "offline" model now, but how can we guarantee they don't go behind our backs and change that?
    • Exactly! Without those fundamentals you've mentioned, Democracy is literally just Demonstration of Crazy, nothing to be proud of in such system.
  • Recent Achievements

    • Veteran
      Yonah went up a rank
      Veteran
    • First Post
      viraltui earned a badge
      First Post
    • Reacting Well
      viraltui earned a badge
      Reacting Well
    • Week One Done
      LunaFerret earned a badge
      Week One Done
    • Week One Done
      Ricky Chan earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      481
    2. 2
      +FloatingFatMan
      264
    3. 3
      snowy owl
      238
    4. 4
      ATLien_0
      233
    5. 5
      Edouard
      176
  • Tell a friend

    Love Neowin? Tell a friend!