dezkit Posted August 4, 2008 Share Posted August 4, 2008 how can i do so that anything below the image doesn't load until EVERYTHING loads. <html> <head> </head> <body onLoad="init()"> <div id="loading"><center><img src="loading.gif" border=0></center></div> <script> var ld=(document.all); var ns4=document.layers; var ns6=document.getElementById&&!document.all; var ie4=document.all; if (ns4) ld=document.loading; else if (ns6) ld=document.getElementById("loading").style; else if (ie4) ld=document.all.loading.style; function init() { if(ns4){ld.visibility="hidden";} else if (ns6||ie4) ld.display="none"; } </script> <?php $counter = 10; while ( $counter <= 99999 ) { echo $counter; $counter = $counter + 1; echo "<br>"; } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
lemmin Posted August 4, 2008 Share Posted August 4, 2008 This should work: <html> <head> </head> <body> <center><img src="loading.gif" border=0 onload="loading.style.visibility='visible'"></center> <div id="loading" style="visibility:'hidden'"> content </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 4, 2008 Author Share Posted August 4, 2008 i have no idea what you just did, can you fix it within my code, thanks sooo much Quote Link to comment Share on other sites More sharing options...
Stooney Posted August 5, 2008 Share Posted August 5, 2008 You could use an output buffer http://us2.php.net/manual/en/function.ob-start.php Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 THIS IS PHP HELP NOT JS Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 THIS IS PHP HELP NOT JS Caps lock is certainly not cruise control for cool on a PHP forum. Just letting you know. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 thnks DW im still right though Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 5, 2008 Author Share Posted August 5, 2008 darkwater you're too young to be a /b/tard Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 Not a /b/tard, don't worry. Anyway, regarding to the original problem...Try: <html> <head> </head> <body> <div id="loading" style="display:none;'"> <center><img src="loading.gif" border=0 onload="document.getElementById('loading').style.display= 'block';"></center> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 5, 2008 Author Share Posted August 5, 2008 yeah, where do i put that :/ Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 In place of that whole Javascript block and the current HTML. <html> <head> </head> <body> <div id="loading" style="display:none;'"> <center><img src="loading.gif" border=0 onload="document.getElementById('loading').style.display= 'block';"></center> </div> <dib id="content"> <?php $counter = 10; while ( $counter <= 99999 ) { echo $counter; $counter = $counter + 1; echo "<br>"; } ?> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 5, 2008 Author Share Posted August 5, 2008 i still see the numbers Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 Wait do you want the numbers to disappear afterwards? >_> Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 5, 2008 Author Share Posted August 5, 2008 noooooooooooooooooooooooooooo >.< when i click on the page i want there t display the loading.gif until all the numbers load, and when they load, display them. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 The whole page will load at the same time because PHP sends all the data at once. You'll need Ajax for that effect. Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 5, 2008 Author Share Posted August 5, 2008 kk thanks broski Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 do you want something like this http://djw-webdesign.awardspace.com/Mail%20App/ Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 5, 2008 Author Share Posted August 5, 2008 YEAH!!! that's exactly what i want! Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 well i am to tired to write the code out , but the logic is , have a set of tags (div for me) that have the image inside , and use JS to hide the rest of the page (that needs to be in tags, div) e.g. <html> <script type="text/javascript"> document.getElementById('main').style.visibility="hidden"; function loading() { document.getElementById("main").style.visibility="visible"; document.getElementById('loader').style.visibility="hidden"; document.getElementById('loader').style.marginTop="0%"; document.body.style.backgroundColor="#CCCCCC"; document.getElementById('loader').innerHTML = ' '; } </script> <style type="text/css"> body { visibility:hidden; background-color:#000000; } </style> <body onLoad="loading()"> <div id="loader" align="center" class="test"> <h1>Loading</h1> <br /><img src="loading.gif" alt="loading" align="absmiddle"> </div> <div align="center" id="main"> Main stuff </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 5, 2008 Author Share Posted August 5, 2008 thank you so much! 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.