Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PLEASE HELP: Banner Rotator Problem

    I worked all night last night and got my Banner rotator working perfectly. Then I get an message from someone saying it isn't working! I go check it out, and for some reason it won't work in Netscape. It works perfect in IE.

    Here is the script: can anyone help me out? The whole thing is in the BODY section. The banners rotate correctly, but the link is always the same one! Like I said it works fine in IE.

    <script language="JavaScript">
    var imgs1 = new Array("http://www.shophoenixproject.com/banners/midwest.gif","http://www.shophoenixproject.com/banners/shonut.gif","http://www.shophoenixproject.com/banners/sfc.gif")
    var lnks1 = new Array("http://www.midwestsho.com/","http://www.shonutperformance.com/","http://www.shoforum.com/ubb/ultimatebb.php?ubb=get_topic;f=6;t=001714")
    var currentdate = new Date();
    var currentAd1 = randomRange(2);
    var imgCt1 = 3

    function randomRange(inMin,inMax) {
    var min = 0, max = 0;
    if (inMin) min = inMin;
    if (inMax) max = inMax;
    if (min > max) {
    var swop = min
    min = max
    max = swop
    }
    return min + Math.floor(Math.random() * (max - min + 1))
    }


    function cycle1() {
    currentAd1++
    if (currentAd1 == imgCt1) {
    currentAd1 = 0
    }
    document.adBanner1.src=imgs1[currentAd1]
    adLink1.href=lnks1[currentAd1]
    }

    var timer = window.setInterval("cycle1()",4000);

    </script>
    <a href="http://www.midwestsho.com/" name="adLink1" target="_blank"><img src="http://www.shophoenixproject.com/banners/midwest.gif" name="adBanner1" border="0" width="468" height="60"></a>
    <script language="JavaScript">
    cycle1()
    </script>

    This page can be viewed at http://www.shophoenixproject.com/parts.htm

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    adLink1.href=lnks1[currentAd1]

    try

    document.adLink1.href=lnks1[currentAd1]

  • #3
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried that already, it didn't help

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I noticed that you are only passing one arguement.

    eg: var currentAd1 = randomRange(2);

    .....Willy

  • #5
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Willy Duitt
    I noticed that you are only passing one arguement.

    eg: var currentAd1 = randomRange(2);

    .....Willy
    0,1, and 2

    That part is working fine, because the banners are displaying correctly. It's the links that aren't...

  • #6
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You are not referencing the link correctly which IE allows.
    Here's the correct one:

    document.links['adLink1'].href=lnks1[currentAd1];

    To debug in Netscape, type javascript&#58; in the address bar to see the javascript console.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #7
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You've got to be kidding me.

    It works in NN now, but not in IE!!!
    Last edited by raven_101; 03-12-2004 at 12:09 PM.

  • #8
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I used a script to tell which browser it was using and put an if then else command in, it is all set now.

    thanks a lot for the help.


  •  

    Posting Permissions

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