Click Test 04

This test has a mouseup "click" for only the img tag.

Like v-03, this version puts a click count into the function and makes it visible in the alert. For v-04, the counter updates with each click.

image

Watch out for the Firefox warning in second, third click, etc. Don't disable the dialog or you won't see the incremental count.

Firefox Dialog Warning

The key element is setting a variable in place within the head script, but putting the variable init before the function. According to http://stackoverflow.com/questions/1782741/javascript-how-to-program-a-click-counter. Then call the onmouseUp function with no parameter/argument.

    <script type="text/javascript" language="JavaScript">
      var ct = 0; /* initialize variable before function, making it global. */
      function mouseUp()
      {
        ct = ct + 1;
        alert("Mouse Click\n" + ct);
      }
    </script>