javascript - Counting up numbers that are not lost on page refresh -


i need number shown people registered on web site. nuber digits should counted without losing value. e.g. should start 1 , go on, if refresh page, shouldnt start again 1. should go on. example similar not saving:

    var minuteslabel = document.getelementbyid("minutes");     var secondslabel = document.getelementbyid("seconds");     var totalseconds = 0;     setinterval(settime, 1000);     function settime()     {         ++totalseconds;         secondslabel.innerhtml = pad(totalseconds%60);         minuteslabel.innerhtml = pad(parseint(totalseconds/60));     }      function pad(val)     {         var valstring = val + "";         if(valstring.length < 2)         {             return "0" + valstring;         }         else         {             return valstring;         }     } 

when refresh page memory javascript has created lost.

some options be:

html5 local storage: http://www.w3schools.com/html/html5_webstorage.asp

cookies: http://www.w3schools.com/js/js_cookies.asp

a server-side database such mysql

there services can this, such as: http://www.webestools.com/pages-views-counter-free-number-pages-views-statistics.html


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -