1
I have the following code, the timer works, but when it comes to the end it shows END and restarts. I wanted it to stop in the message END.
var tempo = new Number();
// Tempo em segundos
tempo = 10;
function startCountdown(){
// Se o tempo não for zerado
if((tempo - 1) >= 0){
    // Pega a parte inteira dos minutos
    var min = parseInt(tempo/60);
    // Calcula os segundos restantes
    var seg = tempo%60;
    // Formata o número menor que dez, ex: 08, 07, ...
    if(min < 10){
        min = "0"+min;
        min = min.substr(0, 2);
    }
    if(seg <=9){
        seg = "0"+seg;
    }
    // Cria a variável para formatar no estilo hora/cronômetro
    horaImprimivel = min + ':' + seg;
    //JQuery pra setar o valor
    $("#tempo").html(horaImprimivel);
    // Define que a função será executada novamente em 1000ms = 1 segundo
    setTimeout('startCountdown()',1000);
    // diminui o tempo
    tempo--;
// Quando o contador chegar a zero faz esta ação
} else {
    if (tempo == 0){
    fim = "FIM";
    $("#tempo").html(fim);
    }
}
}
// Chama a função ao carregar a tela
startCountdown();
The code you have does not continue beyond the END message. See it working on Jsfiddle as you have in the question
– Isac