vijay101
01-16-2008, 07:43 AM
Hi....
I have a simple questionaire for a website, and I need help with JS on it. There are 5 questions in all, and 2 options for each...more like a choose the correct answer....i am giving the code below...i need help in JS as to how to check for the correct answer. I tried it for one set, the first question, it worked, but I am unable to duplicate the same function for all 5.
I also don't know if this is the correct way.....
[HTML CODE BEGIN]
<tr>
<td height="25">Choose the Correct Answer </td>
</tr>
<tr>
<td height="25">Q1. I would like to buy this painting because </td>
</tr>
<tr>
<td height="25"><form name="q1form">
<p>
<input type="radio" name="q1"/>
It is cheaper than the others in the Market
<br />
<input type="radio" name="q1"/>
It captures my imagination and grows on me</p>
</form></td>
</tr>
<tr>
<td height="25">Q2. The person who paints the picture and the character of the artist makes no difference to the painting</td>
</tr>
<tr>
<td height="25"><form name="q2form">
<input type="radio" name="q2" />
True<br />
<input type="radio" name="q2" />
False
<br />
</form></td>
</tr>
<tr>
<td height="25">Q2A. The painting is an extension of the artist's personality and life, and reflects on his attitude towards God and man</td>
</tr>
<tr>
<td height="25"><form name="q3form">
<input type="radio" name="q3"/>
True
<br />
<input type="radio" name="q3" />
False
<br />
</form></td>
</tr>
<tr>
<td height="25">Q3. Paintngs are an Investment</td>
</tr>
<tr>
<td height="25"><form name="q4form">
<input type="radio" name="q4" />
True<br />
<input type="radio" name="q4" />
False<br />
</form></td>
</tr>
<tr>
<td height="25">Q3A. Copies and Immitations are the same as the original paintings and have the same effect. </td>
</tr>
<tr>
<td height="25"><form name="q5form">
<input type="radio" name="q5"/>
True<br />
<input type="radio" name="q5" />
False
<br />
</form></td>
</tr>
<tr>
<td height="25"><form name="form1" id="form1" method="post" action="">
<input type="submit" name="Submit" value="Submit" onclick="docheck();"/>
</form></td>
</tr>
</table>
[HTML CODE END]
This basically has a table, in which i have the 5 questions. The answersto the questions arein a form,so I have 4 forms....this where the problem is, maybe I have not laid the document correctly, can you please help ?
I have a simple questionaire for a website, and I need help with JS on it. There are 5 questions in all, and 2 options for each...more like a choose the correct answer....i am giving the code below...i need help in JS as to how to check for the correct answer. I tried it for one set, the first question, it worked, but I am unable to duplicate the same function for all 5.
I also don't know if this is the correct way.....
[HTML CODE BEGIN]
<tr>
<td height="25">Choose the Correct Answer </td>
</tr>
<tr>
<td height="25">Q1. I would like to buy this painting because </td>
</tr>
<tr>
<td height="25"><form name="q1form">
<p>
<input type="radio" name="q1"/>
It is cheaper than the others in the Market
<br />
<input type="radio" name="q1"/>
It captures my imagination and grows on me</p>
</form></td>
</tr>
<tr>
<td height="25">Q2. The person who paints the picture and the character of the artist makes no difference to the painting</td>
</tr>
<tr>
<td height="25"><form name="q2form">
<input type="radio" name="q2" />
True<br />
<input type="radio" name="q2" />
False
<br />
</form></td>
</tr>
<tr>
<td height="25">Q2A. The painting is an extension of the artist's personality and life, and reflects on his attitude towards God and man</td>
</tr>
<tr>
<td height="25"><form name="q3form">
<input type="radio" name="q3"/>
True
<br />
<input type="radio" name="q3" />
False
<br />
</form></td>
</tr>
<tr>
<td height="25">Q3. Paintngs are an Investment</td>
</tr>
<tr>
<td height="25"><form name="q4form">
<input type="radio" name="q4" />
True<br />
<input type="radio" name="q4" />
False<br />
</form></td>
</tr>
<tr>
<td height="25">Q3A. Copies and Immitations are the same as the original paintings and have the same effect. </td>
</tr>
<tr>
<td height="25"><form name="q5form">
<input type="radio" name="q5"/>
True<br />
<input type="radio" name="q5" />
False
<br />
</form></td>
</tr>
<tr>
<td height="25"><form name="form1" id="form1" method="post" action="">
<input type="submit" name="Submit" value="Submit" onclick="docheck();"/>
</form></td>
</tr>
</table>
[HTML CODE END]
This basically has a table, in which i have the 5 questions. The answersto the questions arein a form,so I have 4 forms....this where the problem is, maybe I have not laid the document correctly, can you please help ?