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>

I hope you can help me out.