Need help with a Script

Hi! Thanks in advance for any help!

I have found this nice background rotator:

<style>
body
{
/*Remove below line to make bgimage NOT fixed*/
background-color:black;
background-attachment:fixed;
background-repeat: no-repeat;
/*Use center center in place of 300 200 to center bg image*/
background-position: 300 200;
width:100%; 
height:100%; 
overflow:hidden;
}
</style>
<script language="JavaScript1.2">



/* you must supply your own immages */
var bgimages=new Array()
bgimages[0]="URL"
bgimages[1]="URL"
bgimages[2]="URL"

//preload images
var pathToImg=new Array()
for (i=0;i<bgimages.length;i++)
{
  pathToImg[i]=new Image()
  pathToImg[i].src=bgimages[i]
}

var inc=-1

function bgSlide()
{
  if (inc<bgimages.length-1)
    inc++
  else
    inc=0
  document.body.background=pathToImg[inc].src
}

if (document.all||document.getElementById)
  window.onload=new Function('setInterval("bgSlide()",9000)')
</script>

But i have a little problem… when i run it, i have to wait the 9000 timer to c the first image, and i need the page to start with an image and then start the rotation, i have assigned background-image by css, and tried also to use document.body.background, but when i do this the rotator doesnt work.

Any idea how to tweak this script for do the magic?

Thanks.

Try replacing
window.onload=new Function(‘setInterval(“bgSlide()”,9000)’)

with
window.onload=new Function(‘bgSlide(); setInterval(“bgSlide()”,9000)’)

Hey! TYVM my friend! This do the magic! :smiley:

Not a problem :slight_smile: