Forum Moderators: open

Message Too Old, No Replies

Refresh Image periodically

Little help

         

sadmoody

5:21 am on Dec 21, 2006 (gmt 0)

10+ Year Member



Heya,

I know this script produces a messy result over time, but bear with me for now.

This script is to upload a webcam feed. IMAGE.jpg is continuously updated (hidden the IP as per forum rules). I want the image to be uploaded every second without having blank space (like a <meta http-equiv="refresh" content="1;"> would).

Now, this script works fine locally, but when I upload it to the server, it starts telling me that it needs expected values of ';' or '}' depending on what I try to change to fix it.

I'd appreciate some help :)

Thanks - script is below.

<html>

<script>

var c="#*$!/IMAGE.jpg?"

function count()
{
c=c+1
document.image.src=c
setTimeout("count()",1000)
}

</script>

<body onload="count()">

<p align="center">Live Webcam Feed</p>
<p align="center"><img src="#*$!/IMAGE.jpg" name="image"></p>

</body>

</html>

daveVk

6:23 am on Dec 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CHANGE

function count()
{
c=c+1
document.image.src=c
setTimeout("count()",1000)
}

TO

function count()
{
document.image.src=c;
setTimeout("count()",1000);
}

The statement "c=c+1" looks odd as c is the image url?

Welcome to forum

Fotiman

5:05 pm on Dec 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




<html>
<script>
var webcamimage;
var imgBase="/IMAGE.jpg?"
var c = 0;
function count()
{
webcamimage.src=imgBase+(++c);
}
function init()
{
webcamimage = document.getElementById("webcamimage");
if( webcamimage )
{
setInterval("count()",1000);
}
}
window.onload = init;
</script>
<body>
<p align="center">Live Webcam Feed</p>
<p align="center"><img src="#*$!/IMAGE.jpg" name="image" id="webcamimage"></p>
</body>
</html>