Image event counter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl Gilbert

    #1

    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="JavaS cript" FOR="CamImage1" EVENT="onNewIma ge()"></SCRIPT>
    Any help would be greatly appreciated.
    Regards, Carl Gilbert.


  • Lasse Reichstein Nielsen

    #2
    Re: Image event counter

    "Carl Gilbert" <carl_gilbert@n tlworld.com> writes:
    [color=blue]
    > 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.[/color]
    [color=blue]
    > <SCRIPT LANGUAGE="JavaS cript" FOR="CamImage1" EVENT="onNewIma ge()"></SCRIPT>[/color]

    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 - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Andrew Thompson

      #3
      Re: Image event counter

      "Carl Gilbert" <carl_gilbert@n tlworld.com> wrote in message
      news:rRlKb.257$ FP1.97@newsfep1-gui.server.ntli .net...
      ....
      | <SCRIPT LANGUAGE="JavaS cript" FOR="CamImage1"
      EVENT="onNewIma ge()"></SCRIPT>

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

      comp.lang.javas cript

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


      Comment

      Working...