Results 1 to 2 of 2

Thread: Javascript Image Rotator on Reload

  1. #1
    Join Date
    Jun 2010

    Question Javascript Image Rotator on Reload

    I currently have this script to change the image every time the page is reloaded:

    <script type="text/javascript"><!--
    var img = new Array();

    // Add links to the pictures here, duplicate a line and add between the double-quotes

    // How many random pictures you want to display
    var num = 1;

    // The part where the images are randomed and printed to screen
    for(i=0;i<num;i++) {
    rand = Math.floor(Math.random()*img.length);
    document.write("<img src=\"" + img[rand] + "\" />");

    These are ad images and I'm not very savvy with javascript - how do I get a URL assigned to each individual image in regards to whichever one is loaded at the time? Thanks for your assistance!

  2. #2
    Join Date
    Jun 2010
    Figured it out, please close thread.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles