Jump to content

Pause the script...but not stop it completly


spaceace

Recommended Posts

Hi,

 

Consider the following script;

 

<?

echo 'Hello ';

sleep(1);

echo 'world!';

?>

 

Is it possible to have php process the script so that the web page instantly displays Hello, then pauses for 1 second and then displays world!, instead of what is actually happening which is a 1 second pause followed by Hello world!

 

TIA

Jason

 

put them in two different tags?

 

<?php

// <?php is more versatile than just <? by the way...

 

echo 'Hello';

sleep(1);

?>

 

<?php

echo 'World';

?>

 

but just so you know... neither works for me at all... I'd be more tempted to use Java script for something like this due to the way it handles updating display settings. It's not really something that a server does particularly well. it's much better for the local machine to do it because of different download speeds. Especially if the delay's only 1 second long.

is that not a document effect? If so it's something that should be controlled by javascript.

<?php
echo 'Hello ';
echo '<span id="delay"></span><noscript>world!</noscript>';
?>

 

javascript

 

function triggerCont()

{

setTimeOut(delayText,1000);

}

 

function delayText()

{

el = document.getElementById('delay');

el.innerHTML = 'world!';

}

 

then put the onload="triggerCont();" attribute in you body tag.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.