I have a javascript timer in my page to submit a form if the seconds=0.It is working fine.But the problem is, on refreshing the page,the timer is starting from initial value.
Here is the javascript code
<script>
secs = 300;
timer = setInterval(function () {
var element = document.getElementById("status");
element.innerHTML = "Remaining :<b>"+secs+" sec</b>";
if(secs < 1){
clearInterval(timer);
document.test.submit();
}
secs--;
}, 1000);
Is there any way to avoid this? It can be achieved by preventing page reload. Is that possible?