469,926 Members | 1,558 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

Simple JavaScript Question...

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
1 1296

<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.

Similar topics

reply views Thread by 42 | last post: by
3 posts views Thread by Shelly | last post: by
6 posts views Thread by alex.kemsley | last post: by
4 posts views Thread by Brian Piotrowski | last post: by
7 posts views Thread by James Harris | last post: by
5 posts views Thread by fussfart | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.