473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 4443
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: yawnmoth | last post by:
i've written a php script that generates images dynamically, via the GD library. i now want to detect whether or not the image is embedded within a homepage, or is being viewed by itself. at...
9
by: matthiasjanes | last post by:
Hi, Maybe someone of you can help me. I'm trying to display an image in memory(open file) with an cgi script - but it want work proberly: I'm running an Cgi webserver (CgiServerGui.py). ...
1
by: Leila | last post by:
Hi folks, I have a fairly complex xml document which looks like this: <my:InsideView xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-08-02T14:22:59" xml:lang="en-us">...
6
by: Geoff | last post by:
Here's the situation. I have a static html page which we want to update to include some dynamic content. I want a counter that keeps track of the number of times anyone presses the "add" button,...
2
by: Ralph Krausse | last post by:
I want to create my own kind of counter, for myself. I have a resume page on my site. I want to know how many people go there but dont want to 'go there' myself because I don't want to increase the...
11
by: TomCat | last post by:
Hello, can anyone send me a link or even some sample of script that counts visits to a website ? Thanks, TomCat
1
by: rkapur12 | last post by:
In my jsp code I have an image which if someone clicks on that it stores data like "string1" in the hidden field that I have defined on page as: <html:hidden property="selectedOfficeType"...
9
by: brett | last post by:
I'd like to execute javascript if I'm in a certain directory. I can't figure out how to render the javascript script below. I always end up with some type of parsing error. Any suggestions? ...
1
by: carlg | last post by:
There seem to be plenty of Javascript implemented WYSIWYG editors for editing rich text in a web browser, but I haven't been able to find one that shows line numbers. Even if that was the only...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.