Image event counter

C

Carl Gilbert

Hi
I am looking to generate a counter based on the following event. The event
is generated every time a new image is recieved and this is what I need to
count.
<SCRIPT LANGUAGE="JavaScript" FOR="CamImage1" EVENT="onNewImage()"></SCRIPT>
Any help would be greatly appreciated.
Regards, Carl Gilbert.
 
L

Lasse Reichstein Nielsen

Carl Gilbert said:
I am looking to generate a counter based on the following event. The event
is generated every time a new image is recieved and this is what I need to
count.
<SCRIPT LANGUAGE="JavaScript" FOR="CamImage1" EVENT="onNewImage()"></SCRIPT>

The "for" and "event" attributes are non-standard (IE specific I believe).
You don't need them either.

The event you are looking for is the "load" event (aka "onload").

Try this:

<script type="text/javascript">
var counter = 0;
function countUp() {
counter ++;
}
document.images['CamImage1'].onload = countUp;
</script>

Put this after the image in the page.

/L
 
A

Andrew Thompson

....
| <SCRIPT LANGUAGE="JavaScript" FOR="CamImage1"
EVENT="onNewImage()"></SCRIPT>

Please note that Java and JavaScript are
different languages, for JavaScript, see...

comp.lang.javascript
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top