Re: Progress bar?
| From: | Huy Le | Date: | Fri, 08 Dec 2000 06:55:07 +0000 |
| Subject: | Re: Progress bar? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29295@lists.php.net to get a copy of this message | ||
This can be accomplished using javascript. just send an array of name
background image tags to the browser, then periodically send a forground
image to the browser as the working is being don't on the server. Here is
an example:
<?PHP
flush();
echo "
<img name=twentyfive src=background.gif width=10 height=5>
<img name=fifty src=background.gif width=10 height=5>
<img name=seventyfive src=background.gif width=10 height=5>
<img name=onehundred src=background.gif width=10 height=5>
";
//do some processing until 25% of the work is done then
// send
echo "
<script language=javascript>
document.twentyfive.src='forground.gif'
</script>
";
//do some processing until 50% of the work is done then
// send
echo "
<script language=javascript>
document.fifty.src='forground.gif'
</script>
";
//do some processing until 75% of the work is done then
// send
echo "
<script language=javascript>
document.seventyfive.src='forground.gif'
</script>
";
//do some processing until 100% of the work is done then
// send
echo "
<script language=javascript>
document.onehundred.src='forground.gif'
</script>
";
echo "All done!";
?>
NOTE: It is very important that you must have the flush() call as showed.
If you leave that out, you won't get you want. I just whipped the above so
you can get a clearer idea; i have not tested it yet.
H
At 01:15 PM 12/8/2000 -0600, Obewan Kanubi wrote:
>Me too, that would be great to have that on my site, please include me in
>the infom lists of this knowledge.
>ta ta
>
>
>> yeah .. I would love to know it too.
>>
>> Please Murph, FW the code to me if you will ever discover one.
>>
>> Thanks,
>> Maxim Maletsky.
>>
>> Hi!
>>
>> Has anyone invented a progress bar that displays on a web page to
>entertain
>> the viewer while they wait for a query to finish? I'd be interested in
>> getting a pointer to a snippet of code if you have it.
>>
>> Yours,
>> Murph
>>
>> www.murphatnight.com
>> __________________________________________________________________
>