Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Can anyone help me fix this html....


  • Please log in to reply

#1
x_ember_x

x_ember_x

    Member

  • Member
  • PipPip
  • 22 posts
I made a quiz with results at:

http://www.allthatja...k/degrassi.html

But, something is wrong with the html/code because no matter how different or wrong the answers are, it comes out in only this one result and no other.
The result "ellie & sean" seems to be the only result thats coming up.
:P
Can anyone tell me what is wrong with the javascript? I'm not too familiar with this stuff. Thanks!!



HERE'S THE HTML:

<html>

<head>
<title>Which couple from "Degrassi: The Next Generation" Are You?</title>
<script LANGUAGE="JavaScript">
<!--
function process()
{
var seanellie = 0;
var paigespinner = 0;
var marcodylan = 0;
var craigmanny = 0;
var craigashley = 0;
var chrisemma = 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") { paigespinner++; }
if (value == "2") { seanellie++; }
if (value == "3") { marcodylan++; }
if (value == "4") { craigashley++; }
if (value == "5") { chrisemma++; }
if (value == "6") { craigmanny++; }

for (i = 0; i < f.two.length; i++) if (f.two[i].checked) value = f.two[i].value;
if (value == "1") { chrisemma++; }
if (value == "2") { marcodylan++; }
if (value == "3") { craigashley++; }
if (value == "4") { elliesean++; }
if (value == "5") { craigmanny++; }
if (value == "6") { paigespinner++; }

for (i = 0; i < f.three.length; i++) if (f.three[i].checked) value = f.three[i].value;
if (value == "1") { emmachris++; }
if (value == "2") { craigmanny++; }
if (value == "3") { craigashley++; }
if (value == "4") { seanellie++; }
if (value == "5") { paigespinner++; }
if (value == "6") { marcodylan++; }

for (i = 0; i < f.four.length; i++) if (f.four[i].checked) value = f.four[i].value;
if (value == "1") { marcodylan++; }
if (value == "2") { craigashley++; }
if (value == "3") { paigespinner++; }
if (value == "4") { seanellie++; }
if (value == "5") { craigmanny++; }
if (value == "6") { chrisemma++; }

for (i = 0; i < f.five.length; i++) if (f.five[i].checked) value = f.five[i].value;
if (value == "1") { paigespinner++; }
if (value == "2") { marcodylan++; }
if (value == "3") { seanellie++; }
if (value == "4") { craigmanny++; }
if (value == "5") { chrisemma++; }
if (value == "6") { craigashley++; }

for (i = 0; i < f.six.length; i++) if (f.six[i].checked) value = f.six[i].value;
if (value == "1") { emmachris++; }
if (value == "2") { seanellie++; }
if (value == "3") { marcodylan++; }
if (value == "4") { craigashley++; }
if (value == "5") { paigespinner++; }
if (value == "6") { craigmanny++; }


var seanellie = 0;
var paigespinner = 0;
var marcodylan = 0;
var craigmanny = 0;
var craigashley = 0;
var chrisemma = 0;

var out = "seanellie";
i = seanellie;
if (paigespinner > i) { out = "paigespinner"; i = paigespinner; }
if (marcodylan > i) { out = "marcodylan"; i = marcodylan; }
if (craigmanny > i) { out = "craigmanny"; i = craigmanny; }
if (craigashley > i) { out = "craigashley"; i = craigashley; }
if (chrisemma > i) { out = "chrisemma"; i = chrisemma; }
location.href = out + ".html";
}
function err(msg, url, line)
{
location.href = "error.html";
}
//window.onerror = err;
// -->
</SCRIPT>
</head>

<body bgcolor="#2E3E5F" text="white">
<center><img src="http://img47.photobu....jpg"></center>
<font face="Verdana" size="1">
<form name="f">
<b>When you and your significant other talk, it's mostly...</B><br><br>
<input type="radio" name="one" value="1">playful banter. Secretly, you love it.<br>
<input type="radio" name="one" value="2">full of sexual tension. Rawr!<br>
<input type="radio" name="one" value="3">bashful but sweet exchanges. You just haven't known each other that long to be 100% comfortable, is all.<br>
<input type="radio" name="one" value="4">casual talk. Hey, you know each other as friends inside out.<br>
<input type="radio" name="one" value="5">cautious language. You really want him/her to like you!<br>
<input type="radio" name="one" value="6">sizzlin, but cheesy. All you're there for is the lovin', really!<p>

<b>Once you two got together...</B><br><br>
<input type="radio" name="two" value="1">no one really saw it coming.<br>
<input type="radio" name="two" value="2">you caused quite a stir, both good and bad.<br>
<input type="radio" name="two" value="3">a lot of people thought it made sense.<br>
<input type="radio" name="two" value="4">sparks flew quite quickly.<br>
<input type="radio" name="two" value="5">you didn't want everyone to know. <br>
<input type="radio" name="two" value="6">it was just, "awwww".<p>

<b>The time he/she really charmed you was when this was said:</B><br><br>
<input type="radio" name="three" value="1">"I think we should hang out!"<br>
<input type="radio" name="three" value="2">(Stare in eyes. Kiss. Kiss. Kiss. More kissing.)<br>
<input type="radio" name="three" value="3">"Do you wanna go out on a date sometime (hopeful smile)?"<br>
<input type="radio" name="three" value="4">"Hey. I think you're cute." <br>
<input type="radio" name="three" value="5">"I think I owe you a date (reassuring smile)."<br>
<input type="radio" name="three" value="6">"I know exactly how you feel."<p>

<b>What do you love most about your datee?</B><br><br>
<input type="radio" name="four" value="1">We're fated, you know? Plus, HELLO, the HOTness factor!<br>
<input type="radio" name="four" value="2">You share similar interests & have good times.<br>
<input type="radio" name="four" value="3">He/she's just. so. cute! How can you resist?<br>
<input type="radio" name="four" value="4">I find him/her just incredibly sexy in his/her own way. <br>
<input type="radio" name="four" value="5">Such a temptation. So I'm giving in..<br>
<input type="radio" name="four" value="6">You know, he/she's just a cool person. <p>

<b>When you're together, you guys:</B><br><br>
<input type="radio" name="five" value="1">have so much fun being with each other.<br>
<input type="radio" name="five" value="2">are so happy to have found each other.<br>
<input type="radio" name="five" value="3">don't have much expectations, just going with wherever this takes you two.<br>
<input type="radio" name="five" value="4">can't get enough of one another!<br>
<input type="radio" name="five" value="5">play it cool, like close friends.<br>
<input type="radio" name="five" value="6">are like an old couple; bickering but in a cute loving way.<p>

<b>Pick a color to represent your relationship.</B><br><br>
<input type="radio" name="six" value="1">Orange<br>
<input type="radio" name="six" value="2">Scarlet<br>
<input type="radio" name="six" value="3">Baby blue<br>
<input type="radio" name="six" value="4">Deep green<br>
<input type="radio" name="six" value="5">Yellow<br>
<input type="radio" name="six" value="6">Dark purple<p>

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

</html>

<_< :D :D
  • 0

Advertisements


#2
ditto

ditto

    - i pwn n00bs -

  • Member
  • PipPipPipPip
  • 1,260 posts
hey x_ember_x,

I do not know javascript too well but it looks similar to C++ (took a class last year in C). Any way i think this is your problem.

var seanellie = 0; 
var paigespinner = 0; 
var marcodylan = 0; 
var craigmanny = 0; 
var craigashley = 0;
var chrisemma = 0;

var out = "seanellie"; 
i = seanellie; 
if (paigespinner > i) { out = "paigespinner"; i = paigespinner; } 
if (marcodylan > i) { out = "marcodylan"; i = marcodylan; } 
if (craigmanny > i) { out = "craigmanny"; i = craigmanny; } 
if (craigashley > i) { out = "craigashley"; i = craigashley; } 
if (chrisemma > i) { out = "chrisemma"; i = chrisemma; } 
location.href = out + ".html";

If you just follow the variables that you have for each couple name, they are all set to 0 even after the user inputs their answer. then continue down and the out and i variable are set to "seanellie" and since ever name is set to 0, none of them will be greater than i (seanellie). So take the second block of code where u set the variable names to 0.

hope it helps. let me know how it ends up.

ditto
  • 0

#3
x_ember_x

x_ember_x

    Member

  • Topic Starter
  • Member
  • PipPip
  • 22 posts
Hi Ditto!

I did take out the second block of var ___ = 0 code and now seanellie is not the only answer anymore. However, now chrisemma is! All answers lead to chrisemma and I still can't figure this out, lol. <_<

What is messing the quiz up? :D

Thanks for your help so far!

Here's what it looks like now:

<html>

<head>
<title>Which couple from "Degrassi: The Next Generation" Are You?</title>
<script LANGUAGE="JavaScript">
<!--
function process()
{
var seanellie = 0;
var paigespinner = 0;
var marcodylan = 0;
var craigmanny = 0;
var craigashley = 0;
var chrisemma = 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") { paigespinner++; }
if (value == "2") { seanellie++; }
if (value == "3") { marcodylan++; }
if (value == "4") { craigashley++; }
if (value == "5") { chrisemma++; }
if (value == "6") { craigmanny++; }

for (i = 0; i < f.two.length; i++) if (f.two[i].checked) value = f.two[i].value;
if (value == "1") { chrisemma++; }
if (value == "2") { marcodylan++; }
if (value == "3") { craigashley++; }
if (value == "4") { elliesean++; }
if (value == "5") { craigmanny++; }
if (value == "6") { paigespinner++; }

for (i = 0; i < f.three.length; i++) if (f.three[i].checked) value = f.three[i].value;
if (value == "1") { emmachris++; }
if (value == "2") { craigmanny++; }
if (value == "3") { craigashley++; }
if (value == "4") { seanellie++; }
if (value == "5") { paigespinner++; }
if (value == "6") { marcodylan++; }

for (i = 0; i < f.four.length; i++) if (f.four[i].checked) value = f.four[i].value;
if (value == "1") { marcodylan++; }
if (value == "2") { craigashley++; }
if (value == "3") { paigespinner++; }
if (value == "4") { seanellie++; }
if (value == "5") { craigmanny++; }
if (value == "6") { chrisemma++; }

for (i = 0; i < f.five.length; i++) if (f.five[i].checked) value = f.five[i].value;
if (value == "1") { paigespinner++; }
if (value == "2") { marcodylan++; }
if (value == "3") { seanellie++; }
if (value == "4") { craigmanny++; }
if (value == "5") { chrisemma++; }
if (value == "6") { craigashley++; }

for (i = 0; i < f.six.length; i++) if (f.six[i].checked) value = f.six[i].value;
if (value == "1") { emmachris++; }
if (value == "2") { seanellie++; }
if (value == "3") { marcodylan++; }
if (value == "4") { craigashley++; }
if (value == "5") { paigespinner++; }
if (value == "6") { craigmanny++; }


var out = "seanellie";
i = seanellie;
if (paigespinner > i) { out = "paigespinner"; i = paigespinner; }
if (marcodylan > i) { out = "marcodylan"; i = marcodylan; }
if (craigmanny > i) { out = "craigmanny"; i = craigmanny; }
if (craigashley > i) { out = "craigashley"; i = craigashley; }
if (chrisemma > i) { out = "chrisemma"; i = chrisemma; }
location.href = out + ".html";
}
function err(msg, url, line)
{
location.href = "error.html";
}
//window.onerror = err;
// -->
</SCRIPT>
</head>

<body bgcolor="#2E3E5F" text="white">
<center><img src="http://img47.photobu....jpg"></center>
<font face="Verdana" size="1">
<form name="f">
<b>When you and your significant other talk, it's mostly...</B><br><br>
<input type="radio" name="one" value="1">playful banter. Secretly, you love it.<br>
<input type="radio" name="one" value="2">full of sexual tension. Rawr!<br>
<input type="radio" name="one" value="3">bashful but sweet exchanges. You just haven't known each other that long to be 100% comfortable, is all.<br>
<input type="radio" name="one" value="4">casual talk. Hey, you know each other as friends inside out.<br>
<input type="radio" name="one" value="5">cautious language. You really want him/her to like you!<br>
<input type="radio" name="one" value="6">sizzlin, but cheesy. All you're there for is the lovin', really!<p>

<b>Once you two got together...</B><br><br>
<input type="radio" name="two" value="1">no one really saw it coming.<br>
<input type="radio" name="two" value="2">you caused quite a stir, both good and bad.<br>
<input type="radio" name="two" value="3">a lot of people thought it made sense.<br>
<input type="radio" name="two" value="4">sparks flew quite quickly.<br>
<input type="radio" name="two" value="5">you didn't want everyone to know. <br>
<input type="radio" name="two" value="6">it was just, "awwww".<p>

<b>The time he/she really charmed you was when this was said:</B><br><br>
<input type="radio" name="three" value="1">"I think we should hang out!"<br>
<input type="radio" name="three" value="2">(Stare in eyes. Kiss. Kiss. Kiss. More kissing.)<br>
<input type="radio" name="three" value="3">"Do you wanna go out on a date sometime (hopeful smile)?"<br>
<input type="radio" name="three" value="4">"Hey. I think you're cute." <br>
<input type="radio" name="three" value="5">"I think I owe you a date (reassuring smile)."<br>
<input type="radio" name="three" value="6">"I know exactly how you feel."<p>

<b>What do you love most about your datee?</B><br><br>
<input type="radio" name="four" value="1">We're fated, you know? Plus, HELLO, the HOTness factor!<br>
<input type="radio" name="four" value="2">You share similar interests & have good times.<br>
<input type="radio" name="four" value="3">He/she's just. so. cute! How can you resist?<br>
<input type="radio" name="four" value="4">I find him/her just incredibly sexy in his/her own way. <br>
<input type="radio" name="four" value="5">Such a temptation. So I'm giving in..<br>
<input type="radio" name="four" value="6">You know, he/she's just a cool person. <p>

<b>When you're together, you guys:</B><br><br>
<input type="radio" name="five" value="1">have so much fun being with each other.<br>
<input type="radio" name="five" value="2">are so happy to have found each other.<br>
<input type="radio" name="five" value="3">don't have much expectations, just going with wherever this takes you two.<br>
<input type="radio" name="five" value="4">can't get enough of one another!<br>
<input type="radio" name="five" value="5">play it cool, like close friends.<br>
<input type="radio" name="five" value="6">are like an old couple; bickering but in a cute loving way.<p>

<b>Pick a color to represent your relationship.</B><br><br>
<input type="radio" name="six" value="1">Orange<br>
<input type="radio" name="six" value="2">Scarlet<br>
<input type="radio" name="six" value="3">Baby blue<br>
<input type="radio" name="six" value="4">Deep green<br>
<input type="radio" name="six" value="5">Yellow<br>
<input type="radio" name="six" value="6">Dark purple<p>

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

</html>
  • 0

#4
ditto

ditto

    - i pwn n00bs -

  • Member
  • PipPipPipPip
  • 1,260 posts
well in the second group of answers you have

if (value == "4") { elliesean++; }

the variable should read seanellie. I tested it out and it seemed to work. However I did get some errors and i think thats because of a tie happening. But it should work without a tie.

let me know

ditto
  • 0

#5
x_ember_x

x_ember_x

    Member

  • Topic Starter
  • Member
  • PipPip
  • 22 posts
YAY! IT WORKS!!

THANK YOU SO MUCH!

I feel like a prized idiot for just having that one phrase rearranged incorrectly and not seeing it! Man.

Thank you again! ! <_<
  • 0

#6
ditto

ditto

    - i pwn n00bs -

  • Member
  • PipPipPipPip
  • 1,260 posts
your quite welcome. <_<

I feel like a prized idiot for just having that one phrase rearranged incorrectly and not seeing it!


sometimes you just need another pair of eyes to look at it
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP