When started from the local machine, everything is perfect. But when uploading to a web server, he does not want to work. I broke my head, I can not understand. Maybe I do not see?
UPD: Photos should be displayed in random order with each page reload.
UPD2: There is no change of images. Only the photo is visible; the path to which is registered in the img tag. The console does not issue errors.
window.onload = function () { demoFoto(); } // Предварительная загрузка изображений numimgF=0 imgslideF=new Array() imgslideF[0]=new Image() imgslideF[1]=new Image() imgslideF[2]=new Image() imgslideF[3]=new Image() imgslideF[4]=new Image() imgslideF[0].src="images/slideFoto/sf1.jpg" imgslideF[1].src="images/slideFoto/sf2.jpg" imgslideF[2].src="images/slideFoto/sf3.jpg" imgslideF[3].src="images/slideFoto/sf4.jpg" imgslideF[4].src="images/slideFoto/sf5.jpg" function demoFoto() { numimgF = Math.floor(Math.random() * (4 - 0 + 1)) + 0; document.getElementById('irfoto').src=imgslideF[numimgF].src } //////////// body <div class="rfoto"> <img align="center" class="border" height="110" id="irfoto" src="images/slideFoto/sf3.jpg" width="240" /></div>
Sorry for bydlokod, there is no time to write humanly =)