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

182
Visualizações
HTML/Javascript: Submit form when the timer is over

I use unipark to collect something for my thesis. There HTML & Javascript can be used. My subjects are supposed to correct a text in a form and a timer is supposed to run down. When this timer is over, the form should be confirmed and continued. Unfortunately, the whole thing does not work with the confirmation. I hope you can help me.

<html>

<head>
    <div style="color: red"><font size="6">You have <span id="time">01:00</span> minutes!</font></div>
</head>

<script>
function startTimer(duration, display) {
    var timer = duration, minutes, seconds;
    setInterval(function () {
        minutes = parseInt(timer / 60, 10);
        seconds = parseInt(timer % 60, 10);

        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;

        display.textContent = minutes + ":" + seconds;

        if (--timer < 0) {
             document.querySelector('#time').textContent = "Expired"
             document.getElementById('submit').submit();
        }
    }, 1000);
}

window.onload = function () {
    var Minutes = 60 * 0.125,
        display = document.querySelector('#time');
    startTimer(Minutes, display);
};

</script>



</br>

<body>
    <style type="text/css">
      textarea.html-text-box {background-color:ffffff;background-repeat:no-repeat;background-attachment:fixed;border-width:1;border-style:solid;border-color:cccccc;font-family:Arial;font-size:8pt;color:000000;}
      input.html-text-box {background-color:ffffff;font-family:Arial;font-size:8pt;color:000000;}
    </style>
    
<form name="Task" id="textform">

<textarea name="comments" cols="150" rows="50" class="html-text-box"> 
Text to correct
</textarea>

</form>
    <form method="post" action="">
        <input name="submit" type="submit" value="submit">
    </form>
</body>
</html>

So only the button has to be triggered.

It would be best if I could continue clicking the form without the button.

I hope you can help me out.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should do with jquery and ajax. In this way you can have full control over all the operation. What you did in there if you want to continue with that you have to first understand how your back end is working. You need some sort of confirmation from back end.

about 4 years ago · Juan Pablo Isaza Relatório
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