|
javascript problem with online quiz
09-27-2008, 05:06 PM
|
javascript problem with online quiz
|
Posts: 1
|
I am new to Javascript and trying to create a online quiz. I have the quiz showing up. does anyone have the time to help?
the link to the quiz is--
http://familyreadinesscenter.tripod.com/id83.html
but i cant get it to score the quiz and post the correct answer.
the code is
Code:
<HEAD>
<style type="text/css">
<!--
.bgclr {background-color: white; color: black; font-weight: bold;}
-->
</style>
<script language="JavaScript">
<!-- Begin
// Insert number of questions
var numQues =30;
// Insert number of choices in each question
var numChoi =3;
// Insert number of questions displayed in answer area
var answers = new Array(30);
// Insert answers to questions
answers[0] = "feet raised from 8 to 12 inches";
answers[1] = "Re-warm the frozen part QUICKLY by immersing it in water that is warm but not hot";
answers[2] = "Incapacity% 0-25, Death% 0, Clinical effects- 7 days convalescence A small amount of nausea and sickness and noticeable blood cell changes";
answers[3] = "EMP";
answers[4] = "A gaseous vapor too dilute to be easily visible";
answers[5] = "WHO Oral Rehydration Salts";
answers[6] = "Using honey in place of table sugar can flatten out glucose spikes";
answers[7] = "Armadillo tastes like pork and is eaten by indigenous peoples thought their range";
answers[8] = "of their high protein content (12% with 14%) and being excellent for bread making";
answers[9] = "around 9 months";
answers[10] = "it comes to 243 yards";
answers[11] = "wood charcoal from your camp fire";
answers[12] = "all of the above";
answers[13] = "20 lb per person per year is recommended";
answers[14] = "KOSHER SALT";
answers[15] = "Countering radiation poisoning: add I oz to a quart of water and sip until gone";
answers[16] = "For preventing Rust- in bare iron and steel surfaces";
answers[17] = "Soft, velvety leave Mullen: it is natural and safe";
answers[18] = "Make an impenetrate able barrier to repel attack";
answers[19] = "A total of 8 able-bodied lookouts and to allow for illness, accidents or emergencies, two more so the smallest group that can maintain a secure, long term lookout is 10";
answers[20] = "comfrey leaf";
answers[21] = "all of the above";
answers[22] = "only 6-8 pounds";
answers[23] = "for 6 months";
answers[24] = "Palm Oil";
answers[25] = "clarified butter and an excellent frying oil";
answers[26] = "12 eggs";
answers[27] = "Soybean 795 lb of oil/acre or 113 gal/acre";
answers[28] = "1706 jars";
answers[29] = "Boiling and simmering the grain for many hours to make it completely soft";
// Do not change anything below here ...
function getScore(form) {
var score = 0;
var currElt;
var currSelection;
for (i=0; i<numQues; i++) {
currElt = i*numChoi;
for (j=0; j<numChoi; j++) {
currSelection = form.elements[currElt + j];
if (currSelection.checked) {
if (currSelection.value == answers[i]) {
score++;
break;
}
}
}
}
score = Math.round(score/numQues*100);
form.percentage.value = score + "%";
var correctAnswers = "";
for (i=1; i<=numQues; i++) {
correctAnswers += i + ". " + answers[i-1] + "\r\n";
}
form.solutions.value = correctAnswers;
}
// End -->
</script>
<h3>Readiness Quiz</h3>
<form name="quiz">
1. A victim in SHOCK may improve with his?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q1" value="feet raised from 8 to 12 inches">feet raised from 8 to 12 inches</li>
<li><input type="radio" name="q1" value="head raised from 8 to 12 inches">head raised from 8 to 12 inches</li>
<li><input type="radio" name="q1" value="Body in a sitting position">Body in a sitting position</li>
</ul>
2. FROSTBITE may be treated by ?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q2" value="Give him a warm alcoholic drink">Give him a warm alcoholic drink</li>
<li><input type="radio" name="q2" value="Re-warm the frozen part QUICKLY by immersing it in water that is warm but not hot">Re-warm the frozen part QUICKLY by immersing it in water that is warm but not hot</li>
<li><input type="radio" name="q2" value="Re-warm the frozen part and gently massage it">Re-warm the frozen part and gently massage it</li>
</ul>
3. What effects are the a whole-body does of 25-100 rads gamma acquired with in one hour?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q3" value="Incapacity% 0, Death% 0, Clinical effects- no "short-term" effects except some blood cell changes ">Incapacity% 0, Death% 0, Clinical effects- no "short-term" effects except some blood cell changes </li>
<li><input type="radio" name="q3" value="Incapacity% 0-25, Death% 0, Clinical effects- 7 days convalescence A small amount of nausea and sickness and noticeable blood cell changes">Incapacity% 0-25, Death% 0, Clinical effects- 7 days convalescence A small amount of nausea and sickness and noticeable blood cell changes</li>
<li><input type="radio" name="q3" value="Incapacity% 25-100, Death% 25% in about 30 to 60 days, Clinical effects- definite identifiable changes in blood, hair loss, livid skin spots, nausea, vomiting, diarrhea, fevers, hemorrhages, and great fatigue. Heart failure in some ">Incapacity% 25-100, Death% 25% in about 30 to 60 days, Clinical effects- definite identifiable changes in blood, hair loss, livid skin spots, nausea, vomiting, diarrhea, fevers, hemorrhages, and great fatigue. Heart failure in some </li>
</ul>
4. Electrons set into motion by gamma rays from a nuclear explosion in space, 250 miles above the Earth's surface, will produce enormous pulses when the negative charges enter the Earth's magnetic-field. This phenomenon is abbreviated?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q4" value="EMP">EMP</li>
<li><input type="radio" name="q4" value="EEP">EEP</li>
<li><input type="radio" name="q4" value="RAD">RAD</li>
</ul>
5. Radioactive isotope Iodine 131 has a short half-life of only 8 days with most of the radioactivity (99+%) being emitted with in two months but is very dangerous to ingest while active. What form does this fallout isotope usually take?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q5" value="Fine sand like partials">Fine sand like partials</li>
<li><input type="radio" name="q5" value="liquid drops falling like rain ">liquid drops falling like rain </li>
<li><input type="radio" name="q5" value="A gaseous vapor too dilute to be easily visible">A gaseous vapor too dilute to be easily visible</li>
</ul>
6. The following is the formula for making
1/4 tsp salt, 1/4 tsp "Lite salt (potassium chloride), 1/2 tsp baking soda, (important if there is green bile vomit or for diarrhea), 2 1/2 tbsp sugar, (preferably corn sugar though table sugar, sucrose, is fine), Dissolve in 1 qt. (or liter) water?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q6" value="WHO IV Fluid Replacement">WHO IV Fluid Replacement</li>
<li><input type="radio" name="q6" value="WHO Oral Rehydration Salts">WHO Oral Rehydration Salts</li>
<li><input type="radio" name="q6" value="Dr. Goods Tasty Energy Drink">Dr. Goods Tasty Energy Drink</li>
</ul>
7.With any type of diabetes, the key is getting the glucose levels as steady as possible
Which of the following is False?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q7" value="vinegar can flatten out glucose spikes in your blood as it slows down the digestion of carbohydrates">vinegar can flatten out glucose spikes in your blood as it slows down the digestion of carbohydrates</li>
<li><input type="radio" name="q7" value="black tea significantly reduces blood sugar levels">black tea significantly reduces blood sugar levels</li>
<li><input type="radio" name="q7" value="Using honey in place of table sugar can flatten out glucose spikes">Using honey in place of table sugar can flatten out glucose spikes</li>
</ul>
8. Should you fear that you'll be infected leprosy by eating armadillo during an emergency. No because-which of these statements is not a good reason ?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q8" value="The disease is not especially contagious; researchers think that 95 percent of humans are naturally immune">The disease is not especially contagious; researchers think that 95 percent of humans are naturally immune</li>
<li><input type="radio" name="q8" value="Fewer than 5 percent of wild armadillos have it; with the Florida population at almost zero of bacteria infection">Fewer than 5 percent of wild armadillos have it; with the Florida population at almost zero of bacteria infection</li>
<li><input type="radio" name="q8" value="Armadillo tastes like pork and is eaten by indigenous peoples thought their range">Armadillo tastes like pork and is eaten by indigenous peoples thought their range</li>
</ul>
9. The hard red and white varieties, either spring or winter, are commonly chosen for storage programs because?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q9" value="of their high protein content (12% with 14%) and being excellent for bread making">of their high protein content (12% with 14%) and being excellent for bread making</li>
<li><input type="radio" name="q9" value="availability and lower costly">availability and lower costly</li>
<li><input type="radio" name="q9" value="of their high starch content providing more energy">of their high starch content providing more energy</li>
</ul>
10. House hold bleach has a shelf life, at 70oF, bleach will be effective in treating water for?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q10" value="around 6 months ">around 6 months </li>
<li><input type="radio" name="q10" value="around 9 months">around 9 months</li>
<li><input type="radio" name="q10" value="a couple of years">a couple of years</li>
</ul>
11.We all know how important it is to keep your dental health during a long term EOTWAWKI as do-it-yourself dentistry is not present to even contemplate. How much floss would a family of 4 need in your stores for flossing each person, every day for 1 year?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q11" value="it comes to 100 yards">it comes to 100 yards</li>
<li><input type="radio" name="q11" value="it comes to 100 feet">it comes to 100 feet</li>
<li><input type="radio" name="q11" value="it comes to 243 yards">it comes to 243 yards</li>
</ul>
12.In the The Joys of Being Homeless, the author relates about getting dysentery... I couldn't walk five feet without having to void myself bloody. Then he remembered something from a class in the Marines that one possible way to get rid of it was to eat charcoal twice a day until your symptoms were gone. Two days later, his "problem" went away. What did he use for the charcoal?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q12" value="Barbecue briskets ">Barbecue briskets</li>
<li><input type="radio" name="q12" value="wood charcoal from your camp fire ">wood charcoal from your camp fire</li>
<li><input type="radio" name="q12" value="Burnt toast ">Burnt toast </li>
</ul>
13. The iodine in Iodized salt may be adversely affected during storage by the following condition?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q13" value="Moisture & humid ">Moisture & humid </li>
<li><input type="radio" name="q13" value="Excessively aerated environment">Excessively aerated environment</li>
<li><input type="radio" name="q13" value="all of the above ">all of the above </li>
</ul>
14.For each100 pounds of meat, dry curing uses 6 pounds salt with more for brining small game and odd pieces. At a minimum, for preserving meat, (with a safety factor) what amount is recommended for storage?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q14" value="10 lb per person per year is recommended">10 lb per person per year is recommended</li>
<li><input type="radio" name="q14" value="20 lb per person per year is recommended">20 lb per person per year is recommended</li>
<li><input type="radio" name="q14" value="30 lb per person per year is recommended">30 lb per person per year is recommended </li>
</ul>
15. A type of salt that contains no additives or added iodine, is usually rolled to make the grains flaked for easier dissolving and draw out the blood rubbed on meat in cure?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q15" value="Table SALT">Table SALT</li>
<li><input type="radio" name="q15" value="CANNING SALT">CANNING SALT</li>
<li><input type="radio" name="q15" value="KOSHER SALT">KOSHER SALT</li>
</ul>
16. Soda (Sodium Bicarbonate); Which one of these is not one of the 28 uses?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q16" value="Countering radiation poisoning: add I oz to a quart of water and sip until gone">Countering radiation poisoning: add I oz to a quart of water and sip until gone</li>
<li><input type="radio" name="q16" value="Scalding a chicken: Add 1 tbl. Of soda to the boiling water. The feathers will come off easier and flesh will be clean and white">Scalding a chicken: Add 1 tbl. Of soda to the boiling water. The feathers will come off easier and flesh will be clean and white</li>
<li><input type="radio" name="q16" value="Fire Extinguishing powder: baking soda by your stove in case of grease, kerosene or electrical fire. Scatter the powder by the handful to safely put it out">Fire Extinguishing powder: baking soda by your stove in case of grease, kerosene or electrical fire. Scatter the powder by the handful to safely put it out</li>
</ul>
17. Uses for LYE SOAP; which is not a legitimate use?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q17" value="For preventing Rust- in bare iron and steel surfaces">For preventing Rust- in bare iron and steel surfaces</li>
<li><input type="radio" name="q17" value="For Catfish Bait- Softened and shaped and with or without blended worm or fish">For Catfish Bait- Softened and shaped and with or without blended worm or fish</li>
<li><input type="radio" name="q17" value="For Making Bug Spray- for plants, suds suffocate many insects and larva">For Making Bug Spray- for plants, suds suffocate many insects and larva</li>
</ul>
18. When the Toilet Paper finally runs out, you have many options: Which of these is not recommended for outhouse use?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q18" value="paper towels, news paper, catalog pages, crinkled & softened">paper towels, news paper, catalog pages, crinkled & softened</li>
<li><input type="radio" name="q184" value="Soft, velvety leave Mullen: it is natural and safe">Soft, velvety leave Mullen: it is natural and safe</li>
<li><input type="radio" name="q18" value="personal sponges (kept soaking in salt brine) that are easily cleaned before reuse">personal sponges (kept soaking in salt brine) that are easily cleaned before reuse</li>
</ul>
19. Fences do 2 more things besides keep out and/or in animals and small children?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q19" value="slow your attackers down giving time for you to react">slow your attackers down giving time for you to react</li>
<li><input type="radio" name="q19" value="channel the enemy into areas where you want him to be (kill zones)">channel the enemy into areas where you want him to be (kill zones)</li>
<li><input type="radio" name="q19" value="Make an impenetrate able barrier to repel attack">Make an impenetrate able barrier to repel attack</li>
</ul>
20.Jeff Cooper wrote an article called Notes on Rural Defense (For the Privet Citizen in Times of Disorder) Two people can stand Back-to-back watches for a limited time and, while doing so, nothing else can be done. What is the minimum number of adult personnel to maintain 24/7 security for an isolated retreat?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q20" value="A total of 6 able-bodied lookouts and to allow for illness, accidents or emergencies, two more so the smallest group that can maintain a secure, long term lookout is 8">A total of 6 able-bodied lookouts and to allow for illness, accidents or emergencies, two more so the smallest group that can maintain a secure, long term lookout is 8</li>
<li><input type="radio" name="q20" value="A total of 8 able-bodied lookouts and to allow for illness, accidents or emergencies, two more so the smallest group that can maintain a secure, long term lookout is 10">A total of 8 able-bodied lookouts and to allow for illness, accidents or emergencies, two more so the smallest group that can maintain a secure, long term lookout is 10</li>
<li><input type="radio" name="q20" value="A total of 10 able-bodied lookouts and to allow for illness, accidents or emergencies, two more so the smallest group that can maintain a secure, long term lookout is 12">A total of 10 able-bodied lookouts and to allow for illness, accidents or emergencies, two more so the smallest group that can maintain a secure, long term lookout is 12</li>
</ul>
21. Vegetable Rennet: Cheese makers have utilized plants for making cheese before commercial rennet was available. What plant is not used?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q21" value="lady's bedstraw">lady's bedstraw</li>
<li><input type="radio" name="q21" value="comfrey leaf">comfrey leaf</li>
<li><input type="radio" name="q21" value="stinging nettle">stinging nettle</li>
</ul>
22. Based on the amount of grain you need to eat per day for enough useable protein (pounds required for 100% of protein RDA by limiting Amino Acid). Which one is true?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q22" value="Wheat, Hard Red Winter..0.6lb ">Wheat, Hard Red Winter..0.6lb </li>
<li><input type="radio" name="q22" value="Rice, White ... 0.8lb">Rice, White ... 0.8lb</li>
<li><input type="radio" name="q22" value="all of the above">all of the above</li>
</ul>
23.You jug and trout lines have been producing and you have been eating well but it is time to move on. There are still 40 fish left, which equals 40 pounds. This is far too much weight to transport on your back, You are going to have to dehydrate (dry) the fish down to an easily carry weight for one person. When you are done your 40 pounds of fish will weigh?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q23" value="only 6-8 pounds">only 6-8 pounds</li>
<li><input type="radio" name="q23" value="only 8-10 pounds">only 8-10 pounds</li>
<li><input type="radio" name="q23" value="only 4-6 pounds">only 4-6 pounds</li>
</ul>
24. STORING EGGS WITH WATERGLASS: Eggs coated with WATERGLASS (Sodium Silicate) in a cool basement, cellar or fridge will kept ________ if they are turned once a week (in the carton)?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q24" value="for 1 months">for 1 months</li>
<li><input type="radio" name="q24" value="for 3 months">for 3 months</li>
<li><input type="radio" name="q24" value="for 6 months">for 6 months</li>
</ul>
25. Best Storing Fats: The best fats for storage are those that are naturally resistant to oxidation or going rancid. There are several factors which effect this ability to oxidation. Which of these stores the very best?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q25" value="Palm Oil">Palm Oil</li>
<li><input type="radio" name="q25" value="Canola Oil">Canola Oil</li>
<li><input type="radio" name="q25" value="Sunflower oil">Sunflower oil</li>
</ul>
26. Under survival conditions, you might expect 30 to 40 pounds of milk per day from a cow. If you got 40 lb of milk, your one average dairy cows daily production represents; 40lb fresh milk per day or 4.1 lbs. of cheese or 1.7 lbs of butter* or 1.3 lb of ghee*. What is ghee and how is it used for?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q26" value="clarified butter and an excellent frying oil">clarified butter and an excellent frying oil</li>
<li><input type="radio" name="q26" value="fermented alcoholic milk product drunk in the Asian steps">fermented alcoholic milk product drunk in the Asian steps</li>
<li><input type="radio" name="q26" value="special high protein yogurt for the lactose intolerant">special high protein yogurt for the lactose intolerant</li>
</ul>
27.Egg yolks are another source of necessary diet fat that is rich in all of the fat soluble vitamins, (A, D, E and K) and one of the few foods naturally containing vitamin D. How many eggs would your homestead need to produce to meet the minimum daily fat requirement of 1 adult for one day if it is your only source?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q27" value="12 eggs">12 eggs</li>
<li><input type="radio" name="q27" value="6 eggs">6 eggs</li>
<li><input type="radio" name="q27" value="2 eggs">2 eggs</li>
</ul>
28.There are a number of oil seeds that could be grown to supply cooking oil. The following are some: Your yields without proper fertilizer or herbicides might be considerably lower but which yield is far too large?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q28" value="Corn 129 lbs of oil/acre or 18 gal/acre ">Corn 129 lbs of oil/acre or 18 gal/acre</li>
<li><input type="radio" name="q28" value="sunflowers 714 lb of oil/acre or 102 gal/acre ">sunflowers 714 lb of oil/acre or 102 gal/acre </li>
<li><input type="radio" name="q28" value="Soybean 795 lb of oil/acre or 113 gal/acre ">Soybean 795 lb of oil/acre or 113 gal/acre </li>
</ul>
29.According to the Utah State University Extension, only use quarts, and no smaller sizes, a family of 4 will need per year (if you can all your food)?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q29" value="706 jars">706 jars</li>
<li><input type="radio" name="q29" value="1706 jars">1706 jars</li>
<li><input type="radio" name="q29" value="170 jars">170 jars</li>
</ul>
30. Experimenters at Oak Ridge got sore tongues and very loose bowels when they tried to eat enough boiled whole-kernel wheat to supply even half of their daily energy needs. Yet the American pioneers and European peasants ate large quantities of whole-kernel wheat without harmful results. What did they do different?
<ul style="margin-top: 1pt">
<li><input type="radio" name="q30" value="Sprouted the grain before cooking">Sprouted the grain before cooking</li>
<li><input type="radio" name="q30" value="Boiling and simmering the grain for many hours to make it completely soft">Boiling and simmering the grain for many hours to make it completely soft</li>
<li><input type="radio" name="q30" value="Only cooked soft, starchy types of wheat">Only cooked soft, starchy types of wheat</li>
</ul>
<input type="button" value="Get score" onClick="getScore(this.form)">
<input type="reset" value="Clear answers">
<p> Score = <strong><input class="bgclr" type="text" size="8" name="percentage" disabled></strong><br><br>
Correct answers:<br>
<textarea class="bgclr" name="solutions" wrap="virtual" rows="30" cols="30" disabled>
</textarea>
</form>
<p><center>
<font face="arial, helvetica" size"-2"></center><p>
<!-- Script Size: 3.82 KB -->
|
|
|
|
09-28-2008, 01:01 AM
|
Re: javascript problem with online quiz
|
Posts: 486
Name: Matt
|
Take a look at your browsers JS error console. You will notice something saying something like getScore is not defined. You have defined getScore. The problem may be because you haven't closed the head tag. Depending on the browser your JS functions may not be defined until you close the head. It is best to only have one head at the beginning of your document instead of switching from body to head because it is more acceptable and it stops these sorts of things from happening.
I didn't take a long look at your code so it may be something else but that's where I'd start.
__________________
PHP Code:
$talkupation++;
Please login or register to view this content. Registration is FREE - Free IPB forum hosting (releasing today!!!), no ads, free modifications
|
|
|
|
09-28-2008, 07:20 AM
|
Re: javascript problem with online quiz
|
Posts: 3
Name: William Peterson
|
just passed by when searching around for online quiz. according to my experiences, maybe you can try the sweet app Hot Potatoes to do the easy job than just coding. actually, in order to avoid any javescript errors in browers, i usually take flash-based quiz for online use (for flash, QuizCreator is recommended). i hope my suggestion helps.
william peterson
senior elearning analyst
|
|
|
|
|
« Reply to javascript problem with online quiz
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|