I am trying to reload a page every X amount of seconds with Javascript, I need to be able to hit a button to stop it and start it though
So when you go to the page it will just start refreshing every 5 seconds, then you can hit a stop button. Once stopped you can hit a start button to get it going again.
I am not sure how I can do this, can someone help, so far all I got is this..
<script>
function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
timedRefresh(5000);
</script>
Just need a way to stop it and start it up again
Put this on your page,
When stopped,
When started,
Update: updated after the poster updated the question.