470,591 Members | 1,498 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Image event counter

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.
Jul 20 '05 #1
2 1586
"Carl Gilbert" <ca**********@ntlworld.com> writes:
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
"Carl Gilbert" <ca**********@ntlworld.com> wrote in message
news:rR**************@newsfep1-gui.server.ntli.net...
....
| <SCRIPT LANGUAGE="JavaScript" FOR="CamImage1"
EVENT="onNewImage()"></SCRIPT>

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

comp.lang.javascript

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Carl Gilbert | last post: by
reply views Thread by sakieboy | last post: by
7 posts views Thread by JellyON | last post: by
4 posts views Thread by Tomasz Bak | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.