Tylmaril,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
window.onload = function () {
var i = 30;
var time_div = document.getElementById('time_div');
function timer() {
// alert(i);
if (i < 25) {
time_div.innerHTML = "timeout";
} else {
time_div.innerHTML = "00:" + i;
i--
window.setTimeout(timer, 2000);
}
}
document.getElementById('button').onclick = timer
}
</script>
</head>
<body>
<div id="time_div">00:30</div>
<div>
<input id="button" type="button" value=" кнопка" />
</div>
</body>
</html>