show number of clicks?

Giganews Newsgroups
Subject: show number of clicks?
Posted by:  Geoff Cox (gc…@freeuk.notcom)
Date: Sat, 01 Mar 2008

Hello

The code below counts the number of times that the image is clicked.

I would like to be able to dispay the number of clicks when the user
decides that he/she wishes to know the total at that point.

'would appreciate some ideas on how to do this.

Cheers

Geoff

<script type="text/javascript">

function countClicks(thecount){
document.getElementById(thecount).innerHTML =
parseFloat(document.getElementById(thecount).innerHTML)+1;
}
</script>

<img src="images/count.gif" onclick="countClicks('number');">

<span id="number" style="visibility:hidden">0</span>

Replies