LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Javasript to count number of mouse clicks (http://www.linuxquestions.org/questions/programming-9/javasript-to-count-number-of-mouse-clicks-331551/)

LinuxLala 06-08-2005 11:04 AM

Javasript to count number of mouse clicks
 
Hi

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 12:38 PM

Quote:

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-17-2005 12:58 AM

thanks jonaskoelker. I shall look into it.

jonaskoelker 06-17-2005 01:23 AM

yw


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