I can't get this script to recognize that the image name is
Image53.jpg, Image54.jpg, etc. instead of 53.jpg, 54.jpg.
What am I doing wrong? I'm trying to not have to change a thousand image names. :D
Image53.jpg, Image54.jpg, etc. instead of 53.jpg, 54.jpg.
What am I doing wrong? I'm trying to not have to change a thousand image names. :D
Code:
//change x=0 to x=1 change current= 0 to current = 1 Works! // The 1 = the first image number for both X and Current! imgName = new Array() for (x=53; x<=100; x++) { imgName[x] = x } contextPath = " http://www.tpgames.net/gaming/4/2/tpgames/zwp/tce/"; extensionJ = "Image"; extensionK = ".jpg"; current = 47; //ONLY CHANGE THIS NUMBER! MAKE 10 PER STORY //window.onload = randomizeImage function randomizeImage() { changeImg() } function changeImg() { holder = document.getElementById("bgHolder"); holder.style.background="url(" + contextPath + extensionJ + imgName[current] + extensionK + ")"; if (current < imgName.length-1) { current = current+1 } else { current = 1 } setTimeout('randomizeImage()',1000); } setTimeout('randomizeImage()',1000);//only is executed on pageload function randomizeImage() { holder = document.getElementById("bgHolder"); if (holder==null){ setTimeout('randomizeImage()',1000);} else{ changeImg(); } }
Comment