...

View Full Version : Navigation Button/Event manager



Spency
12-07-2012, 01:36 AM
Evening everyone,

I'm building a browser based multiple choice based test - what I want is for the questions in the test to be randomized on load- what I also want is that, if they have not selected an answer for a question, they cannot navigate to the next question.

I can get the questions to shuffle without the navigation prevention and I can do the navigation prevention to work perfectly, but only if shuffling is disabled or if the question happens to be in same order as it is in the array. The function does work with shuffling, but only if by mere chance, the order in which the questions were shuffled is identical to the order of the questions in the array.



var CurrQNum = 0;
function ChangeQ(ChangeBy){
if ((State[CurrQNum][0] == -1)){ShowMessage('You have not selected an answer yet!'); return;}
if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;}
QArray[CurrQNum].style.display = 'none';
CurrQNum += ChangeBy;
QArray[CurrQNum].style.display = '';
ShowSpecialReadingForQuestion();
SetQNumReadout();
SetFocusToTextbox();
}


var I=new Array();
I[0]=new Array();I[0][0]=100;
I[0][1]='';
I[0][2]='0';
I[0][3]=new Array();
I[0][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1]=new Array();I[1][0]=100;
cI[0][3][1]=new Array('Worst Answer','Try again!',0,0,1);
I[1][1]='';
I[1][2]='0';
I[1][3]=new Array();
I[1][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1][3][1]=new Array('Worst Answer','Click OK, then "Next Question."',0,0,1);


<p style="text-align: Center;">
<input id="NextQButton" name="button" type="submit" value="Next Question" onclick="ChangeQ(1)">
</p>

Attached is the full exercise. The original authors of the code commented out the navigation handler... I wonder if they had issues as well.

I would really appreciate anyone's advice or help. Thank you in advance,
Spence.

Evening everyone,

Posted this originally in the wrong forum I think, but here is a copy.
I'm building a browser based multiple choice based test - what I want is for the questions in the test to be randomized on load- what I also want is that, if they have not selected an answer for a question, they cannot navigate to the next question.

I can get the questions to shuffle without the navigation prevention and I can do the navigation prevention to work perfectly, but only if shuffling is disabled or if the question happens to be in same order as it is in the array. The function does work with shuffling, but only if by mere chance, the order in which the questions were shuffled is identical to the order of the questions in the array.



var CurrQNum = 0;
function ChangeQ(ChangeBy){
if ((State[CurrQNum][0] == -1)){ShowMessage('You have not selected an answer yet!'); return;}
if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;}
QArray[CurrQNum].style.display = 'none';
CurrQNum += ChangeBy;
QArray[CurrQNum].style.display = '';
ShowSpecialReadingForQuestion();
SetQNumReadout();
SetFocusToTextbox();
}


var I=new Array();
I[0]=new Array();I[0][0]=100;
I[0][1]='';
I[0][2]='0';
I[0][3]=new Array();
I[0][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1]=new Array();I[1][0]=100;
cI[0][3][1]=new Array('Worst Answer','Try again!',0,0,1);
I[1][1]='';
I[1][2]='0';
I[1][3]=new Array();
I[1][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1][3][1]=new Array('Worst Answer','Click OK, then "Next Question."',0,0,1);


<p style="text-align: Center;">
<input id="NextQButton" name="button" type="submit" value="Next Question" onclick="ChangeQ(1)">
</p>

Attached is the full exercise. The original authors of the code commented out the navigation handler... I wonder if they had issues as well.

I would really appreciate anyone's advice or help. Thank you in advance,
Spence.

Spency
12-07-2012, 01:33 PM
http://hotpot.uvic.ca/howto/hacking_workshop/task_08_2.htm

These authors described implementing the navigation prevention, but explicitly said it will not work with shuffling.

Does anyone have a solution?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum