Bootstrap Templates Bundle

Tuesday, January 15, 2013

Hit Counter

If any one wants to add a hit counter for specific link or key or button then add this below code
N.B: I recommend you to see my post  Download/Link Hit Counter for better result
Sample1 : 

  <TITLE> Clicker Counter Thingamajig </TITLE>
<script type="text/javascript">
var clicks = 0;
function linkClick(){
    document.getElementById('clicked').value = ++clicks;
document.write('<a href="" onclick="linkClick()">Click Me!</a>');
You have clicked the link <input id="clicked" size="3" onfocus="this.blur();"
value="0" > times.

<!DOCTYPE html>
<script src=""></script>
     <input type='submit' value='like' onclick='' id='aa' />
         <p style='clear: left;'> <span>0</span> like this. </p>
         $("#aa").click(function () {
                 var n = parseInt($("span").text(), 10);
                         var a=0;
                         n = n + 1;
             $("span").text( a = parseInt(a) + parseInt(n));

limitation: Restore with each page load

No comments:

Post a Comment

Wokiee React eCommerce Template