Use this code I've made for you instead, place in BODY section as usual:
It's important to note the instructions on this line:
// The final number (default=3) of the next line must be equal to the number of images present.
inc=Math.floor(Math.random() * 3)
The code:
Code:
<style>
body{
/*Remove below line to make bgimage NOT fixed*/
background-attachment:fixed;
background-repeat: no-repeat;
/*Use center center in place of 300 200 to center bg image*/
background-position: 300 200;
}
</style>
<script language="JavaScript1.2">
//Background Image Slideshow- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com
//modified by cr3ative for random backgrounds
//Specify background images to slide
var bgslides=new Array()
bgslides[0]="bgslide.jpg"
bgslides[1]="bgslide2.jpg"
bgslides[2]="bgslide3.jpg"
//Specify interval between slide (in miliseconds)
var speed=3000
//preload images
var processed=new Array()
for (i=0;i<bgslides.length;i++){
processed[i]=new Image()
processed[i].src=bgslides[i]
}
var inc=-1
function slideback(){
if (inc<bgslides.length-1)
// The final number (default=3) of the next line must be equal to the number of images present.
inc=Math.floor(Math.random() * 3)
else
inc=0
document.body.background=processed[inc].src
}
if (document.all||document.getElementById)
window.onload=new Function('setInterval("slideback()",speed)')
</script>
Regards
cr3ative
Bookmarks