Current I've this: <script type="text/javascript"> function inputDLURL() { document.getElementById('loadingarea').innerHTML = "<form action='<?php echo $server; ?>' method='post' style='text-align:center'><input type='hidden' name='dlurl' value='<?php echo htmlspecialchars($_POST['dlurl']); ?>'><input type='submit' value='Begin your download...'></form><b>Need Help? Check FAQ. <a href='faq.php' target='_blank'><u>Click Here</u></a>"; } </script> <body onload="setTimeout('inputDLURL()', 15000)"> <div id="loadingarea"><br /><img src="images/loading4.gif" alt="Loading"></div> Code (markup): I think it's easy to see that, first I'll have a loading bar for 15 seconds, after that, the download form will show. The problem is the 15 second starts only AFTER the whole site is fully loaded, but sometimes due to ads or large image, it might take quite long to load and in the end the download form will show after more than 15 seconds. I want to ask is it possible to change the coding so that the countdown starts immdiately visitors enter the respective page, without needing to wait for the whole site to load.
Don't set the function setTimeout('inputDLURL()', 15000) in onload of body. Set it after function inputDLURL() like this <script type="text/javascript"> function inputDLURL() { document.getElementById('loadingarea').innerHTML = "<form action='<?php echo $server; ?>' method='post' style='text-align:center'><input type='hidden' name='dlurl' value='<?php echo htmlspecialchars($_POST['dlurl']); ?>'><input type='submit' value='Begin your download...'></form><b>Need Help? Check FAQ. <a href='faq.php' target='_blank'><u>Click Here</u></a>"; } setTimeout('inputDLURL()', 15000); </script> <body> <div id="loadingarea"><br /><img src="images/loading4.gif" alt="Loading"></div>