Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda