the previous answer correct but i should do somthing to it which:
call the method on the body and then
let the function call it self so then you have an infinite loop of rottation
var gSlideshowInterval = 10; /* the interval in seconds */
var gImageCapableBrowser;
var gCurrentImage = 0; /* the default image in the array of images */
var randombgs=["images/body/clarinet.jpg", "images/body/jazzsax.jpg", "images/body/composing.jpg", "images/body/classical-music.jpg"];
function canManipulateImages() {
if (document.images)
return true;
else
return false;
}
function loadSlide(imageURL) {
document.body.style.backgroundImage='url(\''+ imageURL + '\')'; /* change this line to be the actual image you want to change i.e. document.getElementbyId('MyImage').src or something similar */
return true;
}
function nextSlide() {
gCurrentImage = Math.floor(Math.random()*randombgs.length);
loadSlide(randombgs[gCurrentImage]);
// the code changed here
setInterval("nextSlide()",gSlideshowInterval * 1000);
}
//and this will be call once a page load
function onBodyLoad()
{
gImageCapableBrowser = canManipulateImages();
nextSlide();
}
</script>
and here is the html source
<body onload="onBodyLoad">
</body>