Reputation: 1
I'm strugling with a quite simple code. I want to change an image every 2.5s, as a little slideshow of pictures. It is doing the right thing in the source(code inspector in the browser), but the picture is not changing in firefox and opera. IE, Chrome and safari(mobile) is working fine.
<script language="JavaScript">
var i = 0; var path = new Array();
// LIST OF IMAGES
path[0] = "./images/xess1.jpg";
path[1] = "./images/xess2.jpg";
path[2] = "./images/xess3.jpg";
path[3] = "./images/xess4.jpg";
(...)
function swapImage() {
document.slide.src = path[i];
if(i < path.length - 1)
i++;
else i = 0;
setTimeout("swapImage()",2500);
}
window.onload=swapImage;
<div class=left>
<img name="slide" id=inner src="./images/xess1.jpg" />
</div>
I also tried:
document.getElementById('inner').src = path[i];
But it leads to the same result?
Code change works, but image does not change: see here
Thanks!
no, there are no errors in the console:
11:35:32.848 GET http://*******/images/xess1.jpg [HTTP/1.1 200 OK 42676ms]
11:36:17.995 GET http://*******/images/xess2.jpg [HTTP/1.1 200 OK 2493ms]
11:36:20.510 GET http://*******/images/xess3.jpg [HTTP/1.1 200 OK 2744ms]
11:36:23.031 GET http://*******/images/xess4.jpg [HTTP/1.1 200 OK 2492ms]
11:36:25.540 GET http://*******/images/xess5.jpg [HTTP/1.1 200 OK 2492ms]
You can find the page here: www.miramo.de/miramo.de.html
Upvotes: 0
Views: 326
Reputation: 1829
Use braces for the id:
id="inner"
then your line
document.getElementById('inner').src = path[i];
should work.
Upvotes: 1