Hi,
I have the following code that I am playing with:
<script type="text/javascript">
var Dash = {
nextIndex: 0,
dashboards: [
{url: 'http://www.google.com', time: 5},
{url: 'http://www.yahoo.com', time: 10}
],
display: function()
{
var dashboard = Dash.dashboards[Dash.nextIndex];
parent.document.getElementById("iframe1").src = dashboard.url;
Dash.nextIndex = (Dash.nextIndex + 1) % Dash.dashboards.length;
setTimeout(Dash.display, dashboard.time * 1000);
}
};
window.onload = Dash.display;
</script>
Basically it's a routine to cycle through urls in an array into an iframe. My problem is though, when I set the parent.document.getElementById("iframe1").src to url, which works for the first url but it doesn't seem to cycle through to the next url.
If though I create an iframe in the same context of this javascript, say iframe2 and instead just use:
document.getElementById("iframe2").src = dashboard.url;
without the parent.document call, all works fine.
Not sure if it's losing the focus of the javascript when I issue the parent.document call?
Any ideas on how to bring focus back to this javascript code when calling a parent.docuement?
I am using ie6
Thanks.