Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-07-2012, 01:36 AM   PM User | #1
Spency
New to the CF scene

 
Join Date: Nov 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Spency is an unknown quantity at this point
Internet Explorer Navigation Button/Event manager

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.

Code:
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();
}
Code:
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);
Code:
<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.

Code:
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();
}
Code:
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);
Code:
<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.
Attached Files
File Type: txt Tutorial.txt (40.5 KB, 21 views)
File Type: txt Tutorial.txt (40.5 KB, 23 views)

Last edited by VIPStephan; 12-07-2012 at 06:33 PM..
Spency is offline   Reply With Quote
Old 12-07-2012, 01:33 PM   PM User | #2
Spency
New to the CF scene

 
Join Date: Nov 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Spency is an unknown quantity at this point
http://hotpot.uvic.ca/howto/hacking_.../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?

Last edited by Spency; 12-07-2012 at 05:13 PM..
Spency is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:18 AM.


Advertisement
Log in to turn off these ads.