View Full Version : Quiz Not Working


rundellt2000
06-11-2003, 11:20 AM
My quiz isn't working! I finished it completely. Here is the code in my <head> tag:

<SCRIPT LANGUAGE="JavaScript">
<!--
function process()
{
var bart = 0;
var lisa = 0;
var homer = 0;
var marge = 0;
var grampa = 0;
var f = document.f;
var i = 0;

for (i = 0; i < f.one.length; i++) if
(f.one[i].checked) value = f.one[i].value;
if (value == "1") { bart++; }
if (value == "2") { lisa++; }
if (value == "3") { homer++; }
if (value == "4") { marge++; }
if (value == "5") { grampa++; }

for (i = 0; i < f.two.length; i++) if
(f.two[i].checked) value = f.two[i].value;
if (value == "1") { bart++; }
if (value == "2") { lisa++; }
if (value == "3") { homer++; }
if (value == "4") { marge++; }
if (value == "5") { grampa++; }

for (i = 0; i < f.three.length; i++) if
(f.three[i].checked) value = f.three[i].value;
if (value =="1") { bart++; }
if (value == "2") { lisa++; }
if (value == "3") { homer++; }
if (value == "4") { marge++; }
if (value == "5") { grampa++; }

for (i = 0; i < f.four.length; i++) if
(f.four[i].checked) value = f.four[i].value;
if (value =="1") { bart++; }
if (value == "2") { lisa++; }
if (value == "3") { homer++; }
if (value == "4") { marge++; }
if (value == "5") { grampa++; }

for (i = 0; i < f.five.length; i++) if
(f.five[i].checked) value = f.five[i].value;
if (value =="1") { bart++; }
if (value == "2") { lisa++; }
if (value == "3") { homer++; }
if (value == "4") { marge++; }
if (value == "5") { grampa++; }

var out = "bart";
i = bart;
if (lisa > i) { out = "lisa"; i = lisa; }
if (homer > i) { out = "homer"; i = homer; }
if (marge > i) { out = "marge"; i = marge; }
if (grampa > i) { out = "grampa"; i = grampa; }
location.href = out + ".html";
}
function err(msg, url, line)
{
location.href = "error.html";
}
//window.onerror = err;
// -->
</SCRIPT>

And my body tag code:

<input type="radio" name="one" value="1">Devious and naughty<br />
<input type="radio" name="one" value="2">Very smart<br />
<input type="radio" name="one" value="3">Lazy<br />
<input type="radio" name="one" value="4">Too busy<br />
<input type="radio" name="one" value="5">What was that?<br />
<p>

<b>At the mall you would buy...</B><br /><br />
<input type="radio" name="two" value="1">Eggs, fake beer, and all other prank-related merchandise.<br />
<input type="radio" name="two" value="2">BOOKS!<br />
<input type="radio" name="two" value="3">Junk food<br />
<input type="radio" name="two" value="4">Cleaning equipment<br />
<input type="radio" name="two" value="5">Wazzamall?<br />
<p>

<b>If I asked you "Wazzup?" you would answer...</B><br /><br />
<input type="radio" name="three" value="1">Nothing... ;-)<br />
<input type="radio" name="three" value="2">Don't disturb me, I'm reading!<br />
<input type="radio" name="three" value="3">Duh... the sky!<br />
<input type="radio" name="three" value="4">Just packing the lunches.<br />
<input type="radio" name="three" value="5">Whats goin' on with Arnold Rup?<br />
<p>

<b>Your fave flick?</B><br /><br />
<input type="radio" name="four" value="1">The Matrix<br />
<input type="radio" name="four" value="2">Whales: A Documentary<br />
<input type="radio" name="four" value="3">Supermarket Cop<br />
<input type="radio" name="four" value="4">No time for movies.<br />
<input type="radio" name="four" value="5">Back in my day, they didn't use Dee Bee Dees..<br />
<p>

<b>Your least favourite Simpson?</B><br /><br />
<input type="radio" name="five" value="1">Lisa<br />
<input type="radio" name="five" value="2">Bart<br />
<input type="radio" name="five" value="3">Flanders<br />
<input type="radio" name="five" value="4">I dunno<br />
<input type="radio" name="five" value="5">?????<p>

<input type="button" value="Submit!" onclick="process();">

Plz help.

lefty
06-11-2003, 01:19 PM
Do you have <form name="f"> before your questions?

rundellt2000
06-12-2003, 10:06 AM
THANK YOU! It works now... thank you so much lefty! *hugs*

lefty
06-12-2003, 02:49 PM
you're welcome :) Funny how such a little thing can cause so many issues. :P