U bent hier » http://www.goudappel.org/ ooor/random_QMP.php

Willekeurige vraagstukken in QMP

In veel gevallen zijn nummerieke vragen variaties op een thema.
Het is omslachtig en onnodig om meer dan dat thema te programmeren.
Daarom heb ik dit vraagtype ingevoerd:

de onderliggende QML-code is:

<QUESTION STATUS= 'Normal' DESCRIPTION= 'RN' TOPIC= 'klooivragen' ID= '8640173108299056' TYPE= 'text/plain'> <CONTENT TYPE= 'text/html' > <![CDATA[<SCRIPT>// Requires special htmlcore.format, main.format // Check Answer function process%QUESTION.NUMBER%(QNo) {Q=Quest%QUESTION.NUMBER% correctAnswer=Correct%QUESTION.NUMBER% for (var i=5; i<document.forms[0].elements.length; i++) {if (document.forms[0].elements[i].name==QNo) {var item=i break} } ErrorRange=1 if (document.forms[0].elements[item].value>=correctAnswer-ErrorRange & document.forms[0].elements[item].value<=correctAnswer+ErrorRange) {document.forms[0].elements[item+3].value=QuestionText + '<br /><font color=green>Het antwoord, ' + document.forms[0].elements[item].value + ', is juist<br /></font>'} else {temp = Q + '<font color=red>Uw antwoord ' + document.forms[0].elements[item].value + ', is onjuist, het had ' + Math.round(correctAnswer*100)/100 + ' moeten zijn<br /></font>' document.forms[0].elements[item+3].value=temp } } //-------- end process() </SCRIPT> <SCRIPT>// Question body function question%QUESTION.NUMBER%() {]]></CONTENT> <CONTENT TYPE= 'text/html' > <![CDATA[// Question Body - editable! Cijfer1=Math.round(randomnumber%QUESTION.NUMBER%(180)) Cijfer2=Math.round(randomnumber%QUESTION.NUMBER%(180)) QuestionText= 'Maak het volgende sommetje<br />' Correct%QUESTION.NUMBER%=Cijfer1*Cijfer2 ]]></CONTENT> <CONTENT TYPE= 'text/html' > <![CDATA[// Random number generator document.write(QuestionText) document.write('<table border='0'><tr><td>'+Cijfer1+' m x '+Cijfer2+' m = ') Quest%QUESTION.NUMBER%=QuestionText QuestNo%QUESTION.NUMBER%=QuestionNo document.write('<INPUT TYPE=text NAME= ' +%QUESTION.NUMBER% + ' SIZE=10 onChange=process' + %QUESTION.NUMBER% + '(this.name)>') document.write('<INPUT TYPE=hidden NAME=Question VALUE='' + QuestionText + '' >') } function randomnumber%QUESTION.NUMBER%(Max) {rn=Math.round(Math.random()*Max*100)/100 return rn} // Load form RNQ=0 for (i=6;i<document.forms[0].elements.length;i++) {if (document.forms[0].elements[i].name== 'Question') {RNQ=RNQ+1}} QuestionNo=%QUESTION.NUMBER% isNav3 = ( (navigator.appName.indexOf('Netscape') > -1) && (parseInt(navigator.appVersion) >= 3) ) isNav30 = ( (navigator.appName.indexOf('Netscape') > -1) && (parseInt(navigator.appVersion) == 3) ) isIE4 = ( (navigator.appName.indexOf('Internet Explorer') > -1) && (parseInt(navigator.appVersion) > 3) ) if (isIE4==true || isNav3==true) {if (document.forms[0].name== 'FEEDBACK' || document.forms[0].method!= 'post') {} else {if (isNav30==true && RNQ>0) {document.write('You should have seen a question which does not work properly in Netscape 3')} else {question%QUESTION.NUMBER%()} }} else {if (navigator.appName.indexOf('Internet Explorer') > -1) {document.write('You should have seen a question which requires Internet Explorer 4 or better<br />It can be obtained as a free download from <a href=http://www.microsoft.com>Microsoft</a>');} else {if (navigator.appName.indexOf('Netscape') > -1) {document.write('You should have seen a question which requires Netscape version 3 or better<br />It can be obtained as a free download from <a href=http://home.netscape.com>Netscape</a>') }}} </SCRIPT>]]></CONTENT> <CONTENT TYPE= 'text/html' > <![CDATA[</td><td> m<sup>2</sup></td></tr></table> ]]></CONTENT> <ANSWER QTYPE= 'RN' SHUFFLE= 'N'> <CHOICE ID= '0'> <CONTENT WIDTH= '40' TYPE= 'NULL'></CONTENT></CHOICE> </ANSWER> <OUTCOME ID= '0 1' SCORE= '1'> <CONDITION >'0' INCLUDES NOCASE 'Correct'</CONDITION><CONTENT TYPE= 'text/plain'>Juist</CONTENT></OUTCOME> <CONTENT TYPE= 'text/html' > <![CDATA[<SCRIPT>// Display answer if (document.forms[0].name== 'FEEDBACK' || document.forms[0].method!= 'post') { Count=document.forms[0].elements.length document.write(document.forms[0].elements[Count-1].value) } </SCRIPT>]]></CONTENT> </QUESTION>