473,657 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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...dependin g 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 1457

<nu***********@ gmail.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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...dependin g 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1453
by: not | last post by:
Hello All, I am trying to develop a relatively simple self-quiz form in javascript, but I'm having no luck getting it to work. What I am looking for is a script that allow the user to select one of three answers for each question, and automatically assign a value to their answer ("never"=0, "sometimes"=1, "always"=2). There would be anywhere from ten to thirty questions. I want the script to calculate the running total, and then...
2
8387
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
0
1880
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
3
359
by: Shelly | last post by:
Hi, I really don't know javascript, though I can understand existing code. I know java, php, etc. Here is my question, and I assume it is simple. I have a page. On this page I have element_1 and element_2, among others. I have a button, which when clicked I want to go to: www.someotherpage.com?elem1=aaa&elem2=bbb where aaa is the value that is contained in element_1 and bbb is the value
6
2112
by: alex.kemsley | last post by:
Hi guys, I am trying to write a simple script in vain. I need it to first check to see if the cookie exists then if not write one with two variable var ref = document.referrer var page = location.href
4
1533
by: Brian Piotrowski | last post by:
Hi All, After many years of ASP 3.0, I am finally taking the plunge and moving to ASP.NET. I'm going through a few tutorials, and I'm wondering if someone can answer me a question on adding a simple Javascipt to an ASP.NET page. In my old ASP code, I used an #include function to add a javascript to my webpage. I've been reading that it is not recommended to use this technique in ASP.NET. The javascript I would like to add is pretty...
13
2033
by: aum | last post by:
Hi, I'm a Python programmer, just starting to get into javascript. On reading some of the js guides, and not liking any of the OO usage patterns I saw, I've cooked up something which python folks might find to taste. Here's the code - first the 'engine', then some code demonstrating the usage patterns. For me (and maybe for some of you), it promotes readability and some
7
1942
by: James Harris | last post by:
My Googling has let me down here - maybe because when it comes to Java I don't really know which type I need! If someone could point me in the right direction I'd appreciate it. My requirement is simple: to display a 2-d graph within a web page where the X and Y values are taken from a database (residing on the server hosting the web pages). The GUI is to allow panning forwards and backwards over time (the X values are 32-bit timestamps)...
5
1615
by: fussfart | last post by:
I'm trying to do something that should be very simple but isn't working! (I also want to do something somewhat more complicated, but that has to wait until I figure out the simple stuff.) First, I want to call out a .js file from inside a web page to write some stuff. I've done it before, but it's been a while. I've got it ultra-simplified just to try to get it to work. (Once I've got the bugs out, I'm going to put some real code in the .js...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.