PDA

View Full Version : Looking for a JavaScript code for counting clicks


4x4 Mecca
06-07-2007, 01:09 AM
What I want is a javascript I could add to links, where if they click on a link it adds 1 point to userfieldX. The catch is that they could only get the point once per day (Not necessarly 24 hours, but if that's how it would have to work, so be it). So they could only click the link once a day.

Could someone here create that and if so would it be hard to create? :erm: :D

4x4 Mecca
06-08-2007, 06:57 PM
Ok, is it possible?

cyberphr
06-08-2007, 07:59 PM
Java is not JavaScript.

4x4 Mecca
06-08-2007, 11:54 PM
Thanks. I should have known that.

Dismounted
06-09-2007, 04:01 AM
Ok, is it possible?
To answer your question, yes, it is possible.

4x4 Mecca
06-09-2007, 04:43 AM
Thanks, now I'm off to google how I might accomplish that.

VBDev
06-09-2007, 07:33 PM
For that, you should add an onclick event to your link.

Your tag shall look like that :
<a href="your_url" onclick="my_js_function();">URL_TEXT</a>

Then you should create a my_js_function javascript function which update the field you want in the database by executing an ajax call (as it is called on a click on the link).

4x4 Mecca
06-09-2007, 09:36 PM
Thanks vbdev.