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? Link to comment https://forums.phpfreaks.com/topic/39501-count-down-and-refresh-iframe/ 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. Link to comment https://forums.phpfreaks.com/topic/39501-count-down-and-refresh-iframe/#findComment-190792 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.. Link to comment https://forums.phpfreaks.com/topic/39501-count-down-and-refresh-iframe/#findComment-191441 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. Link to comment https://forums.phpfreaks.com/topic/39501-count-down-and-refresh-iframe/#findComment-191444 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..? Link to comment https://forums.phpfreaks.com/topic/39501-count-down-and-refresh-iframe/#findComment-191811 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? Link to comment https://forums.phpfreaks.com/topic/39501-count-down-and-refresh-iframe/#findComment-191965 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. Link to comment https://forums.phpfreaks.com/topic/39501-count-down-and-refresh-iframe/#findComment-192074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.