By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,693 Members | 1,754 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,693 IT Pros & Developers. It's quick & easy.

Simple JavaScript Question...

P: n/a
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.

Dec 15 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

<nu***********@gmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
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
Dec 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.