<div id="1"></div>
<div id="2"></div>
<div id="3"></div>
<script>
t= document.getElementById(1);
timer= function(sec, num) {
t.innerHTML= sec;
if (sec == 0 && num == 3) {
alert("Ба-бах!");
return;
} else if (sec==0) {
t= document.getElementById(++num);
sec= 11;
}
setTimeout(function() {timer(--sec, num)}, 1000);
};
timer(10, 1);
</script>