PDA

View Full Version : Question Concerning JavaScript Kit's New Multiple Choice Quiz


succeedtofail
05-12-2003, 05:34 AM
JavaScript Kit (http://www.javascriptkit.com)'s 'new' multiple choice quiz. This is a flexible quiz template, capable of an unlimited amount of questions and answers. (The download URL is here (http://www.javascriptkit.com/script/cut180.shtml).)

It is composed of three documents: popquiz.htm, quizconfig.js and results.htm. I'm having a confusing problem with 'results.htm'. Displayed on the results page (http://www.javascriptkit.com/script/results.htm), are three basic sections '# of questions you got right', 'The questions you got wrong', and 'Grade in percentage'.

I only want this page to display the 'Grade in percentage' section. In results.htm, I found the area of script where these sections are displayed:

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><form method="POST" name="result"><table border="0" width="100%" cellpadding="0" height="116">
<tr>
<td height="25" bgcolor="#D3FFA8"><strong><font face="Arial"># of questions you got right:</font></strong></td>
<td height="25"><p><input type="text" name="p" size="24"></td>
</tr>
<tr>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got wrong:</font></strong></td>
<td height="17"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
</tr>
<tr>
<td height="25" bgcolor="#D3FFA8"><strong><font face="Arial">Grade in percentage:</font></strong></td>
<td height="25"><input type="text" name="q" size="8"></td>
</tr>
</table>

I have tried removing <tr>
<td height="25" bgcolor="#D3FFA8"><strong><font face="Arial"># of questions you got right:</font></strong></td>
<td height="25"><p><input type="text" name="p" size="24"></td>
</tr>
<tr>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got wrong:</font></strong></td>
<td height="17"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
</tr>
but after the above was removed, the quiz could no longer be graded.

My question: why is this happening and how can I properly remove the areas I specified?

Any and all help is appreciated.

arnyinc
05-12-2003, 01:30 PM
Do you receive an error message after removing those two sections? Most likely there is some javascript trying to set the values of the textareas that you erased, but they no longer exist so it is generating an error.

I would try removing these lines from results.htm

document.result[0].value=totalquestions-incorrect.length+" out of "+totalquestions

for (temp=0;temp<incorrect.length;temp++)
document.result[1].value+=incorrect[temp]+", "