Dear all:
I'm doing my first program with Perl and my knowledge is quite limited but
I'm feeding my little Llama...(still cannot understand the quiz example done
by Randal in his column...)
My program does a multiple question quiz with multiple options valid for each
question, to be running under UNIX. I expect to test about 30 students most
probably at different times.
Using CGI.pm I have this (all the time same test.cgi):
first access you have a form that asks your name and email, when you click on
submit CGI.pm passes the name + email as hidden fields to the real test,
about 20 checkboxes groups, each with 4 alternatives...you fill and click
again to submit and the program compares with the correct results, displays
the results and their evaluation, email copies to the person and to me, and
writes to a log in the server.
QUESTION: I would like to put a timer to the form with the questions, that is
a counter down and if time is over it will submit itself. I got a Javascript
that does that, but
1) How can I integrate this in my program. It seems CGI.pm doesn't allow this
kind of scripts for the header, most examples are for form validation...
2) Is it possible a timer like this with Perl? Then I won't have problems if
Javascript is disabled...
Thanks for your suggestions,
Yours
Georg Fendt
Javascript Timer:
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
finished = false;
time = 60;
function startgrace() {
if(30 > 0) {
alert("This test has a time limit of 60 seconds. You may
start the test now.");
setTimeout("timer()", 1000);
}
}
function timer() {
time--;
window.status = time + " seconds remaining.";
if(time > 0) {
setTimeout("timer()", 1000);
} else {
finished = true;
alert("Your time is up! Please let your test submit
automatically. If nothing happens after 10 seconds, click the Submit button
at the bottom of this page.");
document.test.submitbutton.click();
}
}
function check_finished() {
if(finished) {
alert("Your time has already finished. Please scroll to the
bottom of the test and click \"Submit test\" immediately. Do not attempt to
change any answers.");
return false;
}
return true;
}
//-->
</SCRIPT>
</HEAD>
<BODY onLoad="startgrace()">
_______________________________________________________
Sent through e-mol. E-mail, Anywhere, Anytime. http://www.e-mol.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]