...

View Full Version : sleep() question



chump2877
02-10-2006, 01:42 AM
I have this code:


<HTML>
<HEAD>
<TITLE></TITLE>

</HEAD>

<BODY>


<?

echo 'HELLO WORLD!';

sleep(10);

?>


<script language="JavaScript">
<!--

window.opener.location.href = window.opener.location.href;

if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}

window.close();

-->
</script>


</BODY>
</HTML>

I want to know why I don;t see the phrase "HELLO WORLD!" on the screen for 10 seconds before the javascript closes the window....

Right now, I see a blank screen, then the window closes....How come?

thanks..



Nevermind, this is resolved. I found the answer here: http://www.codingforums.com/showthread.php?t=77880&highlight=sleep

Mhtml
02-10-2006, 12:43 PM
Because you sleep for 20 seconds on the server side, and then the script finishes, php outputs all the data in the output buffer and then the page is loaded but closed instantly by the javascript.

PHP is not intended to manipulate the client side.

[edit:] Didn't see you'd resolved it.. oh well, just another explanation for future searches.

sir pannels
02-10-2006, 02:05 PM
was just gonna point you in the direction of my thread :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum