I have a timer to refresh the page, and it's working:
updateCountdown = function() {
if (Variables.Seconds == Infinity) {
} else if (Variables.Seconds == 0) {
$countdown.text('Bam!');
window.location.replace(Variables.PageName);
} else {
$countdown.text(Variables.Seconds--);
setTimeout(updateCountdown, 1000);
}
};
Then I have this:
document.onkeydown=function(e) {
if (e.which==27) {
Variables.Seconds = 0;
updateCountdown();
}
};
When I press escape, then $countdown.text says 'Bam!', but the page does not refresh like it does whenever Variables.Seconds normally decrements to 0.