SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot carlos_10111's Avatar
    Join Date
    Jun 2006
    Location
    SOUTH AFRICA
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Guys Pliz Help Out With My Ad Rotator

    HTML Code:
    <p align="center"><a href="javascript:changepage()"><img src="images/ad-0.jpg" alt="Banner Advertisement" border="0" hspace="0" name="bannerad" WIDTH="466" HEIGHT="58"></a></p>
    
    <p><script language="JavaScript"><!--
    
    
    function loadpage() {
    browver= parseInt(navigator.appVersion);
    browtype = navigator.appName;
    browsertype = "old";
    if (browtype == "Netscape" && !(browver < 3)) {
    browsertype = "new"; 
    }
    if (browtype == "Microsoft Internet Explorer" && !(browver < 4)) {
    browsertype = "new";
    }
    if (browsertype == "new") {
    thetimer = setTimeout("changeimage()", 3000);
    banneradcode = 0;
    listofimages = new Array(4);
    listofimages[0] = new Image(468,58)
    listofimages[0].src = "images/ad-0.jpg"
    listofimages[1] = new Image(468,58)
    listofimages[1].src = "images/ad-1.jpg"
    listofimages[2] = new Image(468,58)
    listofimages[2].src = "images/ad-2.jpg"
    listofimages[3] = new Image(468,58)
    listofimages[3].src = "images/ad-3.jpg"
    }
    }
    function changeimage(){
    if (browsertype == "new") {
    banneradcode = banneradcode + 1
    if (banneradcode == 4) {
    banneradcode = 0
    }
    imagesource = "ad-"+banneradcode+".jpg"// is my problem lying here?
    window.document.bannerad.src = imagesource
    thetimer = setTimeout("changeimage()", 5000);
    }
    else if (browsertype == "old") {
    }
    }
    function changepage() {
    if(browsertype == "new") {
    if(banneradcode == 0) {
    newlocation = "http://www.babylon6.demon.co.uk/graphics.html"
    }
    else if (banneradcode == 1) {
    newlocation = "http://www.babylon6.demon.co.uk/get_animgifs.html"
    }
    else if (banneradcode == 2) {
    newlocation = "http://www.bmc.org.uk/"
    }
    else if (banneradcode == 3) {
    newlocation = "http://www.babylon6.demon.co.uk/"
    }
    location = newlocation
    }
    else if (browsertype == "old") {
    location = "http://www.babylon6.demon.co.uk/graphics.html"
    }
    }
    // --></script></p>
    
    
    Guys, looking at the code above and seeing it in action here , why do you think the other
    banners are not showing up?
    Please your input will be apreciated!
    Wonders shall never end!

  2. #2
    SitePoint Addict
    Join Date
    Aug 2006
    Location
    Nantwich, Cheshire
    Posts
    363
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I don't understand why you build up the "listofimages" array but don't use it. But in there, the location of the ad files is images/ad-1.jpg and so on, whereas is the changeimage() function (on the line you highlighted) you don't have the "images/" at the start. Could that be it?

  3. #3
    SitePoint Zealot carlos_10111's Avatar
    Join Date
    Jun 2006
    Location
    SOUTH AFRICA
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Thanx men for the quick reply!
    I've the following solutions:
    HTML Code:
    imagesource = listofimages['bannercode'] 
    imagesource ="images/ad-"+banneradcode+".jpg"
    of wich none is working!
    Do you perhaps have a better idea?

    Thanx!
    Wonders shall never end!


Bookmarks

Posting Permissions

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