View Full Version : PLEASE HELP: Banner Rotator Problem

03-12-2004, 11:02 AM
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() {
if (currentAd1 == imgCt1) {
currentAd1 = 0

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

<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">

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

03-12-2004, 11:39 AM



03-12-2004, 11:41 AM
I tried that already, it didn't help :(

Willy Duitt
03-12-2004, 11:45 AM
I noticed that you are only passing one arguement.

eg: var currentAd1 = randomRange(2);


03-12-2004, 11:51 AM
Originally posted by Willy Duitt
I noticed that you are only passing one arguement.

eg: var currentAd1 = randomRange(2);


0,1, and 2

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

03-12-2004, 11:59 AM
You are not referencing the link correctly which IE allows.
Here's the correct one:


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

03-12-2004, 12:02 PM
You've got to be kidding me.

It works in NN now, but not in IE!!!

03-12-2004, 12:27 PM
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.