Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
Why is this timer working and not working?

I made a java timer everything works when all the code is in one file and separated. When I start doing anything about it create a separate js file and move the java code there and even when i try to insert it inside php nawiada in both cases it stops working how is it like here it works and it's great. but i want js in js file then it stops working, I think it is about "'these elements but I don't know, I'll tire of the timer, best regards

var secs = 0;
var element = "czas"; 
var T = null;
function count(id)
{
    temp = secs;
    if(secs > 0)
    {
        result = Math.floor(temp) + "  ";
        document.getElementById(element).innerHTML = result;
        secs--;
    }
    else
    {
        document.location="/"
        clearInterval(T);
    }
}
function counter(seconds)
{
    secs = seconds;
    T = window.setInterval("count()", 1000);
}


echo
    '<div id="czas"></div>
    <script type="text/javascript">counter(60);</script>'
;
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda