473,667 Members | 2,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Quiz Code

Hello:

I found a script for a simple multiple choice quiz that I would like to
tailor to a quiz that I want to post on a website. The quiz I want to use
can be found at :

http://mtl.math.uiuc.edu/users/C2Schult/quiz2.html

Here is my problem. I want to be able to use answers with more than one
word or number which requires spaces. When I tried doing that, it did not
recognize the question as being answered. For example, it would not
recognize an answer of Bob Smith unless I put Bob_Smith which I don't want
to do. The answers in the example are all either 1 word or 1 number answers
so I cannot tell from that how to do this. Can someone tell me what I need
to do to be able to use multiple word answers without having to use an
underscore? Thanks for your help.

David
Jul 20 '05 #1
4 9208
"C. David Rossen" <cd******@cdrma rketing.com> wrote in message
news:O6******** ************@co mcast.com...
Hello:

I found a script for a simple multiple choice quiz that I would like to
tailor to a quiz that I want to post on a website. The quiz I want to use
can be found at :

http://mtl.math.uiuc.edu/users/C2Schult/quiz2.html

Here is my problem. I want to be able to use answers with more than one
word or number which requires spaces. When I tried doing that, it did not
recognize the question as being answered. For example, it would not
recognize an answer of Bob Smith unless I put Bob_Smith which I don't want
to do. The answers in the example are all either 1 word or 1 number answers so I cannot tell from that how to do this. Can someone tell me what I need to do to be able to use multiple word answers without having to use an
underscore? Thanks for your help.

David


I don't see the problem.

The answers are merely hardcoded in the JavaScript :

var aKey = new Array(3);
aKey[0]="distributive" ;
aKey[1]="1/3";
aKey[2]="24/99";

Just include a space in your answer; for example,

aKey[0]="distributi ve property";

Note, you may have to be concerned with case sensitivity if you allow
free-form answers.
Jul 20 '05 #2
OK..when I change all instances of "distributi ve" to "distributi ve
property", it does not recognize the answer as a correct answer. Here are
the places where I changed it:

aKey[0]="distributi ve property";

<input type="radio" name="q1" value="distribu tive property"
onClick=student Ans(1,"distribu tive property") >distributive property<br>

That choice is a correct answer, but along with the other two correct
answers, it is only giving me a 67% score instead of a 100% score so it is
not recognizing "distributi ve property" as a correct answer.

Any ideas? Thanks.
"McKirahan" <Ne**@McKirahan .com> wrote in message
news:vD******** ************@rw crnsc52.ops.asp .att.net...
"C. David Rossen" <cd******@cdrma rketing.com> wrote in message
news:O6******** ************@co mcast.com...
Hello:

I found a script for a simple multiple choice quiz that I would like to
tailor to a quiz that I want to post on a website. The quiz I want to use can be found at :

http://mtl.math.uiuc.edu/users/C2Schult/quiz2.html

Here is my problem. I want to be able to use answers with more than one
word or number which requires spaces. When I tried doing that, it did not recognize the question as being answered. For example, it would not
recognize an answer of Bob Smith unless I put Bob_Smith which I don't want to do. The answers in the example are all either 1 word or 1 number

answers
so I cannot tell from that how to do this. Can someone tell me what I

need
to do to be able to use multiple word answers without having to use an
underscore? Thanks for your help.

David


I don't see the problem.

The answers are merely hardcoded in the JavaScript :

var aKey = new Array(3);
aKey[0]="distributive" ;
aKey[1]="1/3";
aKey[2]="24/99";

Just include a space in your answer; for example,

aKey[0]="distributi ve property";

Note, you may have to be concerned with case sensitivity if you allow
free-form answers.

Jul 20 '05 #3
"C. David Rossen" <cd******@cdrma rketing.com> writes:
<input type="radio" name="q1" value="distribu tive property"
onClick=student Ans(1,"distribu tive property") >distributive property<br>


This is incorrect HTML. You MUST quote attribute values that contain
spaces for it to work. Otherwise, the value ends right after
"distributi ve", giving syntactically incorrect Javascript as well.

According to the HTML definition, you MUST quote attribute values that
contain anything but letters, digits, and a few select types of
punctuation. Browsers are more forgiving than the requirement, but still
fails at spaces, greater-than signs, etc.

For good coding practice, you SHOULD quote all attribute values. It saves
yourself from having to remember the exceptions, and it is more stable
in the cases where you make changes, like here.

So:
<label for="q1Id">
<input type="radio" name="q1" id="q1Id" value="distribu tive property"
onClick='studen tAns(1,"distrib utive property")'>dis tributive property
</label></br>

(use the label tag for the text associated with the radiobutton. Then you
can click the text as well.)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4


C. David Rossen a écrit:
OK..when I change all instances of "distributi ve" to "distributi ve
property", it does not recognize the answer as a correct answer. Here are
the places where I changed it:

aKey[0]="distributi ve property";

<input type="radio" name="q1" value="distribu tive property"
onClick=student Ans(1,"distribu tive property") >distributive property<br>

That choice is a correct answer, but along with the other two correct
answers, it is only giving me a 67% score instead of a 100% score so it is
not recognizing "distributi ve property" as a correct answer.

Any ideas? Thanks.
use method replace ex : string.replace( " ","#") in comparaison and
inverse for display

"McKirahan" <Ne**@McKirahan .com> wrote in message
news:vD******** ************@rw crnsc52.ops.asp .att.net...
"C. David Rossen" <cd******@cdrma rketing.com> wrote in message
news:O6****** **************@ comcast.com...
Hello:

I found a script for a simple multiple choice quiz that I would like to
tailor to a quiz that I want to post on a website. The quiz I want to

use
can be found at :

http://mtl.math.uiuc.edu/users/C2Schult/quiz2.html

Here is my problem. I want to be able to use answers with more than one
word or number which requires spaces. When I tried doing that, it did

not
recognize the question as being answered. For example, it would not
recognize an answer of Bob Smith unless I put Bob_Smith which I don't

want
to do. The answers in the example are all either 1 word or 1 number


answers
so I cannot tell from that how to do this. Can someone tell me what I


need
to do to be able to use multiple word answers without having to use an
underscore ? Thanks for your help.

David


I don't see the problem.

The answers are merely hardcoded in the JavaScript :

var aKey = new Array(3);
aKey[0]="distributive" ;
aKey[1]="1/3";
aKey[2]="24/99";

Just include a space in your answer; for example,

aKey[0]="distributi ve property";

Note, you may have to be concerned with case sensitivity if you allow
free-form answers.



Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2638
by: Sketcher | last post by:
Hi, I am trying to create a quiz, Code is as follows: <html> <head> <title>Quiz</title> </head> <BODY> <Center><TABLE cellSpacing=3 cellPadding=0 border=0>
17
2271
by: rgoya | last post by:
Peace be with you! About a year ago, I created a JavaScript which turns any web site into an online anti-war protest: http://www.geocities.com/rgoya/javascript/PROTEST.HTM I have recently revamped the anti-war quotes quiz: http://www.geocities.com/rgoya/javascript/PROTCODE.HTM#usaquiz Please feel free to
6
1595
by: Vandana Rola | last post by:
Hello Everyone, I posted this question earlier under creating Multiple choice quiz. Is it possible to ignore something using javascript. What I am trying to do is creating a multiple answer quiz. I have five choices out of which user are supposed to choose 3 best choices. The user should get feedback on the choices they make. I have been able to provide the feedback for all the choices but my problem is I am also getting the feedback on...
11
3309
by: admin | last post by:
Hi all, First time poster here... I'm a webmaster and I'd like to add a simple script to my website which will allow users to fill in a brief multiple choice questionaire, and then provide a 'thoughful' suggestion based on their answers. In terms of the logic involved with the actual script: I've mulled it over and thoroughly broken my brain, trying to devise a complicated 'scoring system' (with different answers giving different...
2
1351
by: Cox News | last post by:
Greetings. Any help with this would be greatly appreciated! I use Articulate Quizmaker to develop online quizes. When published, the outputed JS on the HTML page looks like this: http://www.testandlearn.net/resultswebsite/htmlpage.txt the quiz is the swf movie, "assessment.swf". The powers that be at articulate say that the JS on this page can be tweaked
2
3427
by: kenny | last post by:
I'm making a quiz to be posted on the internet. but I'm facing difficulties in finding a simple timer for the quiz (unlimited timing) which will keep on running regardless to the change of the page throughout the quiz. And well how to display the result of the quiz and te grade of the person who has taken the quiz....
2
1643
by: Surya Vellanki | last post by:
Hi all, I have been struggling with this problem from a few days. I hope I will get some help here. I am developing an online quiz portal with ASP.NET 2.0 and I am using Atlas framework for rich UI. I was in need of a timer control which keeps track of the quiz time and sends a post back when the time expires!
5
1495
by: Steve | last post by:
I need to make an HTML page that has multiple choice quiz questions that pull from an XML doc. I have been looking at various online examples of how to do this, mainly this one: http://www.quirksmode.org/dom/importxml.html , but I can't get this damn thing working. Any help is appreciated, but if you write out the html/javascript code you'll be my hero. The example XML doc: <?xml version="1.0" ?> <quiz>
8
6413
by: danjoplin | last post by:
I've only recently started javascript and I'm a java programmer so I'm sure I've done something obvious that I can't see. Basically this goes with an html document which has a number of questions on it, when the form is submitted it gets run through the getScore method. The questions are named q1, q2 etc.. If anyone with experience could help me it would be much appreciated. Thanks, Dan var a = new Array(form.q1.value, form.q2.value,...
0
8366
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
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
8650
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
6206
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
5677
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
4202
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...
1
2779
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
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.