bubblegummy
05-11-2003, 08:50 AM
http://www.geocities.com/starryseeker/quiz.html
When I press the submit button, it just says error at the bottom of the screen...I used starlet's tutorial, but I'm still a little clueless. I'd be grateful if someone could help.
Also, I haven't made the pages for the different results yet,but I wouldn't have thought that that made a difference.
amicus
05-11-2003, 02:18 PM
i removed unnecessary tags and closed others i also made changes to your code. hopefully this works.
<html>
<head>
<script language="javascript">
<!--
function process() {
var zerototwenty = 0;
var twentytoforty = 0;
var fortytosixty = 0;
var sixtytoeighty = 0;
var eightytohundred = 0;
var f = document.f;
var i = 0;
var value = 0;
for (i = 0; i < f.one.length; i++)
if (f.one[i].checked) value = f.one[i].value;
if (value == "1") { eightytohundred++; }
if (value == "2") { sixtytoeighty++; }
if (value == "3") { fortytosixty++; }
if (value == "4") { twentytoforty++; }
if (value == "5") { zerototwenty++; }
value = 0;
for (i = 0; i < f.two.length; i++)
if (f.two[i].checked) value = f.two[i].value;
if (value == "1") { eightytohundred++; }
if (value == "2") { sixtytoeighty++; }
if (value == "3") { fortytosixty++; }
if (value == "4") { twentytoforty++; }
if (value == "5") { zerototwenty++; }
value = 0;
for (i = 0; i < f.three.length; i++)
if (f.three[i].checked) value = f.three[i].value;
if (value == "1") { eightytohundred++; }
if (value == "2") { sixtytoeighty++; }
if (value == "3") { fortytosixty++; }
if (value == "4") { twentytoforty++; }
if (value == "5") { zerototwenty++; }
value = 0;
for (i = 0; i < f.four.length; i++)
if (f.four[i].checked) value = f.four[i].value;
if (value == "1") { eightytohundred++; }
if (value == "2") { sixtytoeighty++; }
if (value == "3") { fortytosixty++; }
if (value == "4") { twentytoforty++; }
if (value == "5") { zerototwenty++; }
value = 0;
for (i = 0; i < f.five.length; i++)
if (f.five[i].checked) value = f.five[i].value;
if (value == "1") { eightytohundred++; }
if (value == "2") { sixtytoeighty++; }
if (value == "3") { fortytosixty++; }
if (value == "4") { twentytoforty++; }
if (value == "5") { zerototwenty++; }
var out = "zerototwenty";
var person1 = 0;
var person2 = 0;
var person3 = 0;
var person4 = 0;
var person5 = 0;
i = person1;
if (person2 > i) { out = "twentytoforty"; i = person2; }
if (person3 > i) { out = "fortytosixty"; i = person3; }
if (person4 > i) { out = "sitytoeighty"; i = person4; }
if (person5 > i) { out = "eightytohundred"; i = person5; }
location.href = out + ".html";
}
function err(msg, url, line) {
location.href = "error.html";
}
// window.onerror = err;
// -->
</script>
</head>
<body>
<form name="f">
<b>1. What is/was your favourite subject at school?</b><br><br>
<input type="radio" name="one" value="1">French<br>
<input type="radio" name="one" value="2">English<br>
<input type="radio" name="one" value="3">Latin<br>
<input type="radio" name="one" value="4">Drama<br>
<input type="radio" name="one" value="5">P.E.<br>
<p>
<b>It's the night before a big set exams. Do you:</b><br><br>
<input type="radio" name="two" value="1">Revise frantically and tear your hair out.<br>
<input type="radio" name="two" value="2">Revise a bit and go bowling<br>
<input type="radio" name="two" value="3">Flick through your books while watching TV<br>
<input type="radio" name="two" value="4">Revision? I went to the cinema today!<br>
<input type="radio" name="two" value="5">What exams?<br>
<p>
<b>Which word describes you best?</b><br><br>
<input type="radio" name="three" value="1">Crazy<br>
<input type="radio" name="three" value="2">Shy<br>
<input type="radio" name="three" value="3">Quiet<br>
<input type="radio" name="three" value="4">Relaxed<br>
<input type="radio" name="three" value="5">Confident<br>
<p>
<b>What do you like to do best?</b><br><br>
<input type="radio" name="four" value="1">Sing<br>
<input type="radio" name="four" value="2">Shop<br>
<input type="radio" name="four" value="3">Surf the net<br>
<input type="radio" name="four" value="4">Watch TV<br>
<input type="radio" name="four" value="5">Do some kind of sport<br>
<p>
<b>What's your favourite food out of these?</b><br><br>
<input type="radio" name="five" value="1">Chocolate<br>
<input type="radio" name="five" value="2">Potatoes<br>
<input type="radio" name="five" value="3">Ice lolly<br>
<input type="radio" name="five" value="4">Chicken<br>
<input type="radio" name="five" value="5">Lettuce<p>
<input type="button" value="Submit!" onclick="process();">
</form>
<p>Learn how to make your own at <a href="http://www.``````````````" target="_blank">``````````````</a>
</body>
</html>
starlet
05-11-2003, 03:02 PM
Or you can just change this bit:
var out = "zerototwenty";
i = person1;
if (person2 > i) { out = "twentytoforty"; i = person2; }
if (person3 > i) { out = "fortytosixty"; i = person3; }
if (person4 > i) { out = "sitytoeighty"; i = person4; }
if (person5 > i) { out = "eightytohundred"; i = person5; }
location.href = out + ".html";
to this:
var out = "zerototwenty";
i = zerototwenty;
if (twentytoforty > i) { out = "twentytoforty"; i = twentytoforty; }
if (fortytosixty > i) { out = "fortytosixty"; i = fortytosixty; }
if (sixtytoeighty > i) { out = "sixtytoeighty"; i = sixtytoeighty; }
if (eightytohundred > i) { out = "eightytohundred"; i = eightytohundred; }
location.href = out + ".html";
The idea is to get rid of all the place it says 'person1' 'person2' etc and replace them with your own :)
amicus
05-11-2003, 03:49 PM
there was also some html errors too. i just went ahead an corrected those. the 'form' tag wasn't closed. the '<br/>' tags i changed to '<br>' 'cos you really don't need it that way unless your parsing this page. other stuff to but those were the high points.
or just do like starlet said :)