How to make counter not reset on page refresh javascript

How to make counter not reset on page refresh javascript<form name="counter">    <

» » How to make counter not reset on page refresh javascript , ago, 108 view
Subscribe to our Facebook Bot


How to make counter not reset on page refresh javascript

<form name="counter">
    <input type="text" size="8" name="chandresh" id="counter">
</form>

<script type="text/javascript">
function getCookie(cname) {
    var name = cname + "=";
    var decodedCookie = decodeURIComponent(document.cookie);
    var ca = decodedCookie.split(';');
    for(var i = 0; i <ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}

var cnt = 60;
function counter(){
    if(getCookie("cnt") > 0){
cnt = getCookie("cnt");
}
cnt -= 1;
document.cookie = "cnt="+ cnt;
jQuery("#counter").val(getCookie("cnt"));

if(cnt>0){
setTimeout(counter,1000);
}

}

counter();
</script>

Read more

2017-01-28T11:33:03Z 250250
Dragplus