Jump to content

Rotating Banner Javascript


Recommended Posts

Hello all, I have a javascript rotating banner script that is supposed to load a random banner on every page load. I currently only have one banner and it was flawless on every page. I recently changed the code for w3c validation and made it a separate .js file and now the banner shows up on the home page, on categories, but not always on product pages. I am using the theme theme001. My code is as follows:

<script src="banner.js" type="text/javascript"></script>

My site is http://littlehousearts.com and the banner is the thin near the top that reads professional quality colors.

 

The javascript file code is:

function random_imglink(){
 var myimages=new Array();
 index=0;
 //specify random images below. You can have as many as you wish
 myimages[1]="<a href='http://littlehousearts.com/28_golden'><img src='/img/golden.png' width='943' alt='GOLDEN Acrylic Paints' /></a>";	
 index=Math.floor(Math.random()*myimages.length);

 if (index == 0){
index=1;
 }
 document.write(myimages[index]);
}
random_imglink()

Any idea why this may occur??

Thank you in advance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...