View Single Post
Old 09-17-2012, 04:35 PM   PM User | #5
LearningCoder
Regular Coder

 
LearningCoder's Avatar
 
Join Date: Jan 2011
Location: The Pleiades
Posts: 849
Thanks: 67
Thanked 28 Times in 28 Posts
LearningCoder is an unknown quantity at this point
Maybe changing the function to something like this:
Code:
var currentImgNumber = 1;
var numberOfImages = 3;

function switchImage(){
   currentImgNumber++;
   document.body.style.background = 'url(images/AdvertImage' + currentImgNumber + '.jpg)';
   if(currentImgNumber == numberOfImages){
       currentImgNumber = 0;
   }
}
Set your additional attributes for the image just like you would do in the css like no repeats x+y etc. You can just add to that statement your other declarations.

Regards,

LC.
LearningCoder is offline   Reply With Quote