...

View Full Version : help with iframe timer



blueyoung
12-03-2009, 04:20 PM
hi , im newbie here and need some help from all the guru here ,
can some 1 help me out with iframe , i want an iframe can do auto reload on list sites after specific time , example after 10 seconds ifram will open google.com and after 10 seconds again iframe will reload yahoo.com and so on.
please some one help me , i had try to search on google and others but still can find it ,
i apreciate all the help thank you

Old Pedant
12-03-2009, 10:08 PM
*COMPLETEL* untested, but try something like this:


<script type="text/javascript">
// create an array with as many urls for the iframe as you wish:
var urls = ["http://www.google.com","http://www.yahoo.com","http://www.ask.com"];
var current_url = 0;

function nextUrl( )
{
document.getElementById("TheIframe").src = urls[current_url % urls.length];
++current_url;
setTimeout("nextUrl()", 10000); // 10 seconds
}
</script>
...
<body onload="nextUrl( )">
...
<iframe id="TheIframe"></iframe>
...

blueyoung
12-04-2009, 02:47 AM
thank you bro i'll try it



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum