<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<script>
var mins = 90; //Set the number of minutes you need
var secs = mins * 60;
var currentSeconds = 0;
var currentMinutes = 0;
var tmr;
tmr = setTimeout(Decrement,1000);
function Decrement() {
console.log(secs);
currentMinutes = Math.floor(secs / 60);
currentSeconds = secs % 60;
if(currentSeconds <= 9) currentSeconds = "0" + currentSeconds;
secs--;
document.getElementById("timer_").innerHTML = currentMinutes + ":" + currentSeconds; //Set the element id you need the time put into.
if(secs !== -1) { tmr = setTimeout('Decrement()',1000); }
if(mins == 0 || secs == 0) window.location.replace("http://stackoverflow.com"); //if time ends its redirrecting to another page
}
function stopTime(tmr) {
clearTimeout(tmr);
}
</script>
<button id="stop" onclick="stopTime(tmr)">Stop</button>
<div id="timer_" style="color: #000; font-size: 150%; font-weight: bold;">
</body>
</html>