View Full Version : help with iframe timer

12-03-2009, 05: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, 11: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];
setTimeout("nextUrl()", 10000); // 10 seconds
<body onload="nextUrl( )">
<iframe id="TheIframe"></iframe>

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