View Full Version : What's wrong w/ my quiz code?


Mystiksky
02-01-2003, 10:19 PM
What's wrong w/ this code?

<html>
<head>
<title>Scooby Doo Quiz</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HEAD>

<TITLE>Scooby Doo Quiz</TITLE><SCRIPT LANGUAGE="JavaScript">
<!--
function process()
{
var Scooby = 0;
var Shaggy = 0;
var Velma = 0;
var Freddy = 0;
var Daphne = 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") { Scooby++; }
if (value == "2") { Shaggy++; }
if (value == "3") { Velma++; }
if (value == "4") { Freddy++; }
if (value == "5") { Daphne++; }

for (i = 0; i < f.two.length; i++) if
(f.two[i].checked) value = f.two[i].value;
if (value == "1") { Scooby++; }
if (value == "2") { Shaggy++; }
if (value == "3") { Velma++; }
if (value == "4") { Freddy++; }
if (value == "5") { Daphne++; }

for (i = 0; i < f.three.length; i++) if
(f.three[i].checked) value = f.three[i].value;
if (value =="1") { Scooby++; }
if (value == "2") { Shaggy++; }
if (value == "3") { Velma++; }
if (value == "4") { Freddy++; }
if (value == "5") { Daphne++; }


for (i = 0; i < f.four.length; i++) if
(f.four[i].checked) value = f.four[i].value;
if (value =="1") { Scooby++; }
if (value == "2") { Shaggy++; }
if (value == "3") { Velma++; }
if (value == "4") { Freddy++; }
if (value == "5") { Daphne++; }

for (i = 0; i < f.five.length; i++) if
(f.five[i].checked) value = f.five[i].value;
if (value =="1") { Scooby++; }
if (value == "2") { Shaggy++; }
if (value == "3") { Velma++; }
if (value == "4") { Freddy++; }
if (value == "5") { Daphne++; }

var out = "Scooby";
i = Scooby;
if ( Shaggy> i) { out = Shaggy; i = Shaggy; }
if ( Velma> i) { out = Velma; i = Velma; }
if (Freddy > i) { out = Freddy; i = Freddy; }
if (Daphne > i) { out = Daphne; i = Daphne; }
location.href = out + ".html";

}
function err(msg, url, line)
{
location.href = "error.html";
}
//window.onerror = err;
// -->
</SCRIPT>
</HEAD>
<BODY BACKGROUND="#000000" BGCOLOR="#000000" TEXT="#ffffff" LINK="#8080ff" VLINK="#800080" ALINK="#75A5F3">
<p align="center"> <font color="#0000FF" size="5"><b>Which Scooby Doo character are you?</b></font></p>
<p align="center"><font color="#0000FF" size="5"><b>ROOBY ROO!</b></font></p>
<p> </p><form name="f">
<p>What is your favorite food? </p>
<p>
<input type="radio" name="one" value="1" checked>
Pretty much anything...there are no bones for me. </p>
<p>
<input type="radio" name="one" value="2">
How can I pick a favorite with all the wonderful things to chose from? </p>
<p>
<input type="radio" name="one" value="3">
Something that I can eat while in deep thought. </p>
<p>
<input type="radio" name="one" value="4">
Something all American like a cheeseburger. </p>
<p>
<input type="radio" name="one" value="4">
Something healthy...perhaps a soy item. </p>
<p>
<p>Are you a guy or girl?
<p>
<input type="radio" name="two" value="1" checked>
A male.
<p>
<input type="radio" name="two" value="2" checked>
A dude.
<p>
<input type="radio" name="two" value="3" checked>
A female.
<p>
<input type="radio" name="two" value="4">
A guy.
<p>
<input type="radio" name="two" value="5">
A babe.
<p>
<p>What is something you would say?
<p>
<input type="radio" name="three" value="1">
"ROOBY, ROOBY-ROO!"
<p>
<input type="radio" name="three" value="2">
"Like, this is really given me the creeps..."
<p>
<input type="radio" name="three" value="3">
"Jenkies"
<p>
<input type="radio" name="three" value="4">
"Let's split up gang"
<p>
<input type="radio" name="three" value="5">
"AHHHH! I fell!"
<p>
<p>Describe your favorite outfit.
<p>
<input type="radio" name="four" value="1" checked>
A collar is very important.
<p>
<input type="radio" name="four" value="2">
Brown jeans and a T-shirt.
<p>
<input type="radio" name="four" value="3">
Very conservative.
<p>
<input type="radio" name="four" value="4">
A bandanna around the neck completes the outfit.
<p>
<input type="radio" name="four" value="5">
Quite short and purple.
<p>
<p>What is your favorite color??
<p>
<input type="radio" name="five" value="1">
I'm colorblind
<p>
<input type="radio" name="five" value="2">
Lime green
<p>
<input type="radio" name="five" value="3" checked>
Orange
<p>
<input type="radio" name="five" value="3">
White and blue
<p>
<input type="radio" name="five" value="5">
Purple
<p>
<p> </form>
<input type="button" value="Jenkies!" onClick="process();" name="button">
</html>



<title>Yahoo! GeoCities</title>
<style type="text/css"><!--
.whBtn {
background-color: BCD8FA;
color: 000000;
font-size: 9pt;
font-family: arial;
}
--></style>



</head>

<body>



</body>
</html>

Dude128
02-02-2003, 01:18 AM
you have three </head> tags and two body sections... the quiz code should be in the head section- get rid of the </head> just before it.

your CSS should be in the first head section, and other than that, you can pretty much get rid of that whole part that comes after your first </html> tag.

you should also get rid of one of your titles, and I believe the <!DOCTYPE... > thing should go before anything else on the page