Hello, I have a piece of js to refresh a page by a timer. Like following: ------------------------------------------------------------ <script> function starttimer() { if(time's up) reload(); else keep counting... } </script> <body onload="starttimer()"> -------------------------------------------------------------- The problem with the above script is the timer won't start unless the page is done loading. Is there any way I can get around this so that the page can be reloaded on a fixed time interval regardless if the page is still being load or not. Thanks in advance.
Hi dreteh, Try this: <script> function starttimer() { if(time's up) reload(); else keep counting... } </script> <body> <script>starttimer();</script> ................................................. Code (markup): Regards, Nick
<script type="text/javascript"> setTimeout("document.location = location.href",HERE_TIME_IN_MILLISECOND); </script> Code (markup):
Thanks for the replies. But calling the function after body tag doesn't work. I am testing with Google chrome.
Works for Me <html> <head> <title>Reload Me</title> </head> <body> Some Text <br> <script type="text/javascript"> setTimeout("document.location = location.href",1000); </script> Some Another Text <br> </body> </html> Code (markup):