-   Programming (
-   -   Javasript to count number of mouse clicks (

LinuxLala 06-08-2005 10:04 AM

Javasript to count number of mouse clicks

I am in a fix. I need to create a Javascript function that keeps track of the number of times a mouse is clicked over a button. No problem. this is done. Next, I would like to print this value. How can I print this value. Also, how do I get it to update the printed value when the mouse is clicked.

Is this possible? OR, should I just let them click on the button as many times as they wish and then they click on another button and the value gets printed.

Please help, I am clueless in either case :)

jonaskoelker 06-08-2005 11:38 AM


How can I print this value
One idea: but the value into a named <input>, and update its value.

Or use <span id="foo">0</span> and update its contents, either by use of innerHTML or some DOM hackery.

In the code that gets called every time the user clicks the button (doesn't that include clicks by a non-mouse device?), call the function that updates the output `thing'.

hth --Jonas

LinuxLala 06-16-2005 11:58 PM

thanks jonaskoelker. I shall look into it.

jonaskoelker 06-17-2005 12:23 AM


All times are GMT -5. The time now is 08:10 PM.