function PreparePrint(form, Questions, NoOfQuestions) {
if (form.StudentName.value == "")
form.StudentName.value = prompt("Ecrivez votre nom.", "")
else {
msgWindow=window.open('','msgWindow','toolbar=yes,location=no,directories=no, status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,width=600,height=500');
msgWindow.document.open()
msgWindow.document.write("
Réponses");
msgWindow.document.write("");
msgWindow.document.write("");
msgWindow.document.write ("" + form.name + "
"); // form name contains title
msgWindow.document.write ("" + form.StudentName.value + "
");
msgWindow.document.write (new Date() + "
");
if (NoOfQuestions < 1) // NoOfQuestions should normally be 0 for automatic calculation
NoOfQuestions = form.elements.length-2; // Last 2 elements are Button and StudentName
if (NoOfQuestions > form.elements.length) // Prevent trying to access more than the # of elements
NoOfQuestions = form.elements.length;
for (i=0; i < NoOfQuestions; i++) {
msgWindow.document.write ("" + Questions[i+1] + "
");
msgWindow.document.write (" " + form.elements[i].value + "
");
}
msgWindow.document.write("");
msgWindow.document.close();
if (navigator.appName.indexOf ("Netscape") >= 0) {
msgWindow.print()
}
}
} // end of JavaScript Function PreparePrint