Posts made by Itamar Tzadok

This link is better than the previous one. wink

I wonder if a simpler improvement for Tikeu specific need would be to allow a Multiple Choice question to present the choices horizontally rather then vertically. Tieku, correct me if I'm wrong but that seems the only difference between what you are trying to get and what the current Multiple Choice question offers (I guess the hack for deducting points could be added to the MC too).
That's the code you presumably used but the highlighted part (which appears in other lines too) shouldn't be there. (And I trust that you remove the X in the Xonclick too). Without it it should work.

<table cellspacing="0" cellpadding="0" border="0"><tbody>
<tr>
<td style="padding-right: 20px" valign="top">This is Queston 1
</td>
<td style="background-color: rgb(221,221,221)" valign="top"><input Xonclick="
****function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() {
****
this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=1;
**** } } } } } }****
" type="radio" name="QUE1" />Not Sure
</td>
<td style="background-color: rgb(221,221,221)" valign="top"><input Xonclick="function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=2; } } } } } }" type="radio" name="QUE1" />True
</td>
<td style="background-color: rgb(221,221,221)" valign="top"><input Xonclick="function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { function anonymous() { this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=3; } } } } } }" type="radio" name="QUE1" />False
</td>
<td style="visibility: hidden" valign="top">{:MULTICHOICE:Not Sure#~=True#~%-100%False#}
</td>
</tr></tbody>
</table>
Is function anonymous the hack for wrong answer penalty? Could you first try the code without that function and see if it works? Then tell me what you are trying to do by this function. What seems to be the problem is that by placing the 'this.parent...' inside the function you change the 'this' reference. You can also try adding the function right after the 'this.parent...;' as a second command.


Hi Tieku

  • Create a Cloze question
  • In the question's text editor change to html mode (ed_html.gif)
  • Paste the following html code
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="padding-right: 20px;" valign="top">Enter question description here</td>
<td style="background-color: rgb(221, 221, 221);" valign="top"><input name="YYYY" Xonclick="this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=1;" type="radio" />Not Sure</td>
<td style="background-color: rgb(221, 221, 221);" valign="top"><input name="YYYY" Xonclick="this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=2;" type="radio" />True</td>
<td style="background-color: rgb(221, 221, 221);" valign="top"><input name="YYYY" Xonclick="this.parentNode.parentNode.childNodes[4].firstChild.selectedIndex=3;" type="radio" />False</td>
<td style="visibility: hidden;" valign="top">{:MULTICHOICE:Not Sure#~=True#~False#}</td>
</tr>
</tbody>
</table>

  • Remove X
  • replace YYYY with a unique name (must be different for each question if you have more than one question in a page)
  • Set the desired correct answers in the MC fields
  • Enter question description where it says 'Enter question description here'
  • Save
  • Create a Description question
  • In the question's text editor change to html mode (ed_html.gif)
  • Paste the following code
<script type="text/javascript">
<!--
var sel=document.getElementsByTagName("select");
for (i=0;i<sel.length;i++){
var ind=sel[i].selectedIndex;
if (sel[i].parentNode.parentNode.childNodes[ind].firstChild.type=="radio"){
sel[i].parentNode.parentNode.childNodes[ind].firstChild.checked=true;
}
}
-->
</script>
  • save
The description question is invisible from students perspective because it displays nothing. It must be included in each quiz page. If you have more than one page you will need to duplicate the question and give each instance a unique name (this at least is what I have to do in 1.6.3; I don't know if that has changed in subsequent versions).

That's about it. Give it a try and let me know how it works.

Itamar smile

P.S. If I may make a suggestion, 'No Idea' seems to me too strong as I might have an idea but I may not be sure enough to select the answer I think is the correct one. Perhaps 'Not Sure' will do more justice in such cases.
Hi Bernard,

var f = null; should be in the page's scope and not in a function so you should remove that line from the display function and set it up such that the form's html includes something like
<script type="text/javascript">var f = null;</script>

That should already work but you can also replace
frames[i].XonBlur= function() { f = frames[i];};
with the simpler
frames[i].XonBlur="f = this";

Let me know if that works. smile

Itamar

Average of ratings: Useful (1)