Re: dynamic graphs (in real time)
| From: | Hugh Bothwell | Date: | Sat, 03 May 2003 21:25:47 +0000 |
| Subject: | Re: dynamic graphs (in real time) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146305@lists.php.net to get a copy of this message | ||
"Wakan" <porcapuzza@yahoo.it> wrote in message
news:5.2.0.9.2.20030503185622.029a6678@pop.mail.yahoo.it...
> Yes,
> but the frequency I need is inferior to 1 sec.
> Is there something like opening a connection
> with the server without closing it, and update
> the image continuously?
> but without flickering problems...
I would look at updating the image client-side using
javascript, something like
<html>
<head>
<script language="javascript"><!--
var swapImg, tDate;
function swapFlipImg() {
document.flipImg.src = swapImg.src;
setTimeout(nextImage, 500);
}
function killCache() {
return
tDate.getTime()
+ "_"
+ Math.floor(Math.random()*100000)
;
}
function nextImage() {
swapImg.src = "myscript.php?"+killCache();
}
function start() {
if (document.images) {
swapImg = new Image();
swapImg.onload = swapFlipImg;
tDate = new Date();
setTimeout(nextImage, 500);
}
}
--></script>
</head>
<body>
Here's the image:<br/>
<img id="flipImg" name="flipImg" src="myscript.php"
onLoad="start()">
</body>
</html>