I have the following JavaScript to rotate pages in a iframe
tag every 5 seconds.
function setPage() {
if (i == pages.length) {
i = 0;
}
alert(pages[i]); //verify the right url is there
var elmnt = document.getElementById('dashboard');
elmnt.setAttribute('src', pages[i]);
i++;
}
setInterval("setPage()", 5000);
The loop, interval, etc., is working. However, nothing changes for the src
attribute of my iframe
tag.
I tested with both IE8 and Chrome.
What am I doing wrong? How can I accomplish that (no jQuery...)