jaymc Posted February 21, 2007 Share Posted February 21, 2007 I need some javascript that will sit on the main index page of my site and count down from 240 seconds When it hits 0 it will refresh an iframe thats on the index page, then start the counter all over again I have javascript that does it from within the iframe but sometimes I get page cannot be displayed and when that happens obviously it wont refresh again Can anyone help? Quote Link to comment Share on other sites More sharing options...
fenway Posted February 21, 2007 Share Posted February 21, 2007 I'm not sure I understand the problem. Quote Link to comment Share on other sites More sharing options...
jaymc Posted February 22, 2007 Author Share Posted February 22, 2007 I basically need javascript to sit on the index of my page.. countdown from 240 seconds and when it hits 0 it will refresh an iframe thats on the page the javascript is on After that, it will simply start the countdown from 240 again and so on.. Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 22, 2007 Share Posted February 22, 2007 I think setInterval() is what you're after: <script type="text/javascript"> setInterval("myRefresh()", 240000); </script> Then, your myRefresh() function would hold the code necessary to refresh the actual iframe. Quote Link to comment Share on other sites More sharing options...
jaymc Posted February 23, 2007 Author Share Posted February 23, 2007 Thats perfect I have that working Whats it like for stability though? Likely to crash browsers or timeout? especially when running for 6 minutes..? Quote Link to comment Share on other sites More sharing options...
artacus Posted February 23, 2007 Share Posted February 23, 2007 Shouldn't cause any problems... but who sits on one page for 6 minutes? Quote Link to comment Share on other sites More sharing options...
obsidian Posted February 23, 2007 Share Posted February 23, 2007 As artacus said, it really shouldn't cause a problem at all. It simply fires once every 240 seconds. It's not going to overload your script in any way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.