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.
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.