www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need help w/rotating banner ads script to show up in multiple locations in same page

  1. #1
    Join Date
    May 2013
    Posts
    3

    Need help w/rotating banner ads script to show up in multiple locations in same page

    Im having problems with the script below.
    Im trying to insert the HTML script in different areas of my site to place different sizes of rotating banner ads for advertising purposes but its only showing me the one size only. Example I inserted the script using the 728x90 banner ad in one area and a 468x60 banner ad in another area. Then the script for the 468x60 is replacing the 728x90 banners so it only shows one.
    I was hoping a kind professional could help me make this script that i can insert in more than location on each page.
    So the million dollar question is: What is it that i have to change or add or both that i could use this banner rotator script multiple times in the same page?? So I'm not sure what to change in the script to distinguish between the two or three and keep them separate.

    Sorry I couldn't place the script on this body it wouldn't let me

    Below is the example of my issue.
    I also have the script on the page to look at..
    www.trisportworld.com/test1.html

  2. #2
    Join Date
    May 2013
    Posts
    3
    This is the continuation on the issue

    I was able to paste the unedited version of the script

    <script >
    function initArray() {
    this.length = initArray.arguments.length;
    for (var i = 0; i < this.length; i++) {
    this[i] = initArray.arguments[i];
    }
    }
    link = new initArray(
    "http://example.com/page1",
    "http://example.com/page2",
    "http://example.com/page3",
    "http://example.com/page4",
    "http://example.com/page5",
    "http://example.com/page6"
    );
    image = new initArray(
    "http://example.com/images/banner_1.jpg",
    "http://example.com/images/banner_2.jpg",
    "http://example.com/images/banner_3.jpg",
    "http://example.com/images/banner_4.jpg",
    "http://example.com/images/banner_5.jpg",
    "http://example.com/images/banner_6.jpg"
    );
    text = new initArray(
    "Example 1 Title",
    "Example 2 Title",
    "Example 3 Title",
    "Example 4 Title",
    "Example 5 Title",
    "Example 6 Title"
    );
    function getRandom(){
    var core = Math.floor(Math.random()*6); // amount of items in array
    displayBanner(core)
    }
    function displayBanner(theNum){
    var ranlink = link[theNum];
    var ranimage = image[theNum];
    var rantext = text[theNum];
    //document.write('<a href=\"' +ranlink+ '\" target=\"_blank\"><img src=\"'+ranimage+'\" border="0" alt=\"'+rantext+'\"></a>');
    document.getElementById('theImg').alt=rantext;
    document.getElementById('theImg').src=ranimage;
    document.getElementById('theLink').href=ranlink;
    }
    </script>
    <a href="#" target="_blank" id="theLink"><img src="" border="0" alt="" id="theImg"></a>
    <script >
    getRandom();
    setInterval("getRandom()", 6000);
    </script>

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