469,586 Members | 2,220 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,586 developers. It's quick & easy.

Javascript image counter


Hi
I'm having problems with the following code.
All I want to do is keep a counter on the page for every new image recieved
without deviating from the "for" and "event".

<OBJECT ID="CamImage1" WIDTH=352 HEIGHT=288
CLASSID="CLSID:C79D3167-6133-4e7c-821C-5C114611022D"

CODEBASE="http://www.ipvideocenter.com/components/CameraControl.cab#VERSION=
3,2,1,0">
<PARAM NAME="URL"
VALUE="http://130.241.175.79/axis-cgi/mjpg/video.cgi?resolution=352x288">
</OBJECT>

<SCRIPT LANGUAGE="JavaScript" FOR="CamImage1" EVENT="onNewImage()">
var counter = 0;
function countUp() {
counter++;
}
document.write(counter);
</SCRIPT>
However this does not increment the counter and the adition of the
document.write line removes the image from the page.
Any help on this would be great. :)
Regards, Carl.
Jul 20 '05 #1
2 4253
this should work:

<OBJECT ID="CamImage1" WIDTH=352 HEIGHT=288
CLASSID="CLSID:C79D3167-6133-4e7c-821C-5C114611022D"

CODEBASE="http://www.ipvideocenter.com/components/CameraControl.cab#VERSION=
3,2,1,0">
<PARAM NAME="URL"
VALUE="http://130.241.175.79/axis-cgi/mjpg/video.cgi?resolution=352x288">
</OBJECT>
<div id="display">0</div>
<script>var counter = 0;</script>
<SCRIPT LANGUAGE="JavaScript" FOR="CamImage1" EVENT="onNewImage()">
counter++;
display.innerHTML = counter;
</SCRIPT>
it doesn't (the control seems to break the .innerHTML reference, this works
though:
<OBJECT ID="CamImage1" WIDTH=352 HEIGHT=288
CLASSID="CLSID:C79D3167-6133-4e7c-821C-5C114611022D"
CODEBASE="http://www.ipvideocenter.com/components/CameraControl.cab#VERSION=
3,2,1,0">
<PARAM NAME="URL"
VALUE="http://130.241.175.79/axis-cgi/mjpg/video.cgi?resolution=352x288">
</OBJECT>
<div id="display">0</div>
<script>var counter = 0;</script>
<SCRIPT LANGUAGE="JavaScript" FOR="CamImage1" EVENT="onNewImage()">
counter++;
document.dis.count.value = counter;
</SCRIPT>
<form name="dis" method="post" action="">
<input type="text" name="count">
</form>
Jul 20 '05 #2
forgot to take out a line:
<OBJECT ID="CamImage1" WIDTH=352 HEIGHT=288
CLASSID="CLSID:C79D3167-6133-4e7c-821C-5C114611022D"

CODEBASE="http://www.ipvideocenter.com/components/CameraControl.cab#VERSION=
3,2,1,0">
<PARAM NAME="URL"
VALUE="http://130.241.175.79/axis-cgi/mjpg/video.cgi?resolution=352x288">
</OBJECT>
<script>var counter = 0;</script>
<SCRIPT LANGUAGE="JavaScript" FOR="CamImage1" EVENT="onNewImage()">
counter++;
document.dis.count.value = counter;
</SCRIPT>
<form name="dis" method="post" action="">
<input type="text" name="count">
</form>


Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by yawnmoth | last post: by
9 posts views Thread by matthiasjanes | last post: by
1 post views Thread by Leila | last post: by
6 posts views Thread by Geoff | last post: by
2 posts views Thread by Ralph Krausse | last post: by
11 posts views Thread by TomCat | last post: by
1 post views Thread by rkapur12 | last post: by
9 posts views Thread by brett | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.