Simple JavaScript Question...

N

number1.email

Hello, I have a simple Web Page Questionairre in which questions are
read from a database, and the user can indicate the correct answer via
either a radio input control or a dropdown list. The number of
questions that is displayed on the screen can vary...depending on the
number of questions that satisfy certain criteria. Does anyone have
any sample code, or can show me how I can validate this Web Page in
JavaScript so that the user is forced to "answer" every question on the
form (whether it is a radio control or dropdown list). Thanks.
 
H

Hal Rosser

Hello, I have a simple Web Page Questionairre in which questions are
read from a database, and the user can indicate the correct answer via
either a radio input control or a dropdown list. The number of
questions that is displayed on the screen can vary...depending on the
number of questions that satisfy certain criteria. Does anyone have
any sample code, or can show me how I can validate this Web Page in
JavaScript so that the user is forced to "answer" every question on the
form (whether it is a radio control or dropdown list). Thanks.

Add a radio button to each question - selected - "Don't Know"
Then it is selected on startup and the user must select a different radio
button - or get it wrong.

For a javascript quiz, one idea is to put each question in a separate form.
The script to grade the quiz could iterate thru the forms array to check if
the correct answer was selected.
The set up some variables
var a = 0;
var b = 1;
var c = 2;
var d = 3;
var e = 4;
Then set up the 'right answer array key'
var rightAns = new Array (a,c,d,b,a,b,a,c,a,d,b,a,);
.....
hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top