开发者

Counting clicks on anchor tag

开发者 https://www.devze.com 2023-02-09 19:59 出处:网络
I have a <a href=\"\" > </a> on a page on my webiste. I wanted to count the number of clicks on this li开发者_C百科nk by the user and display it. How can this be done?best way to represent

I have a <a href="" > </a> on a page on my webiste. I wanted to count the number of clicks on this li开发者_C百科nk by the user and display it. How can this be done?


best way to represent a counter for each a tag on your document and store the data with jquery.data, increasing the counter on each click,

example shown in here : http://jsfiddle.net/ShlomiKomemi/dvdPd/13/


href can have a javascript function call that can do the count and redirect the user to the original page.

Or you can point the href to a server side page that can do the count and redirect the user to the original page.

0

精彩评论

暂无评论...
验证码 换一张
取 消