Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!