I'm trying to build a quiz that takes the answers given and when you hit submit, it totals the number of items in each category and sends you to a specified page...
It's basically perfect except one thing... it doesnt take you to a page when the totals are added up, it just says "Error on page" at the bottom of the screen.
Here's the script:
<p><span style="font-size: small;">Your project needs to get started, but where do you start? Should you use waterjet or laser cutting? What if your material is thick? Take the quiz below and find out what cutting method is best for completing your project!</span></p>
<p><span style="font-size: small;">The Cutting Method Assessment is the perfect tool to help you decide which path to take when you start manufacturing your parts.</span></p>
<!-- begin quiz script -->
<script type="text/javascript"><!--
function finish() {
var ext = '.html';
var results = new Array("none","Waterjet Cutting","Laser Cutting","Water-Only Cutting","Machining or Value-Added","You're Out of Luck");
var nums = new Array(6);
for(var i = 0; i < nums.length; i++) nums[i] = 0;
for(var i = 1; i <= 7; i++) {
var q = document.forms['quiz'].elements['question_'+i];
if(q[0].type=='checkbox') {
var n = 0;
}
for(var j = 0; j < q.length; j++) {
if(q[j].checked) {
var a = q[j].value.split(',');
for(var k = 0; k < a.length; k++) {
nums[a[k]]++;
}
if(q[j].type=='radio') break;
else n++;
}
if(j == q.length-1&&q[j].type=='radio') {nums[0]++;}
}
if(q[0].type=='checkbox'&&((document.forms['quiz'].elements['question_'+i+'_min']&&n<document.forms['quiz'].elements['question_'+i+'_min'].value)||(document.forms['quiz'].elements['question_'+i+'_max']&&n>document.forms['quiz'].elements['question_'+i+'_max'].value))) nums[0]++;
}
var j = new Array('0');
for (i in nums) if(nums[i]>nums[j[0]]){j=new Array(''+i);} else if(nums[i]==nums[j[0]])j[j.length] = i;
//var o = '';for(var i in results)o+=results[i]+'='+nums[i]+'\n';
//alert(o);
if(nums[0]!=0) {
alert('You missed or incorrectly answered '+nums[0]+' questions!');
}
else if(j[0]==0) {
alert('No result could be determined.');
}
else {
location = results[j[0]]+ext;
}
}
// --></script>
<!-- end quiz script --><!-- begin quiz html --><form action="javascript:finish();" enctype="application/x-www-form-urlencoded" method="get">
<table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td width="34%"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><strong>What type of material are you using?</strong> </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1,2" /> Aluminum (6061, 7075, 2024...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="2" /> Carbon Steel (A36, A1011, 4140, 1075...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1,3" /> Composite Material (Fiberglass, G10, Kevlar, Graphite...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1,4" /> Armor Plating or Ballistic Material (HH, AR400, HY80/100...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1,3" /> Rubber (Foam, Silicone, Urethane, Vinyl...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1" /> Exotic Metal (Tantalum, Rhenium, Molybdenum...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1" /> Steel Alloy (Hastelloy, Inconel, Titanium...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1,3" /> Plastic (Acrylic, Delrin, Nylon, UHMW...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1" /> Red Metals (Copper, Brass, Bronze...) </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_1" type="radio" value="1,3" /> Misc. Material (Glass, Slate, Tile, Wood, Cork, Mesh...) </span></span></td>
</tr>
</tbody>
</table>
<br />
<table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td width="34%"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><strong>How thick is your material?</strong> </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_2" type="radio" value="2" /> 0 to 5/8" </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_2" type="radio" value="1,3" /> 3/4" to 2" </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_2" type="radio" value="1" /> 2.125" to 12" </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_2" type="radio" value="5" /> Over 12" thick </span></span></td>
</tr>
</tbody>
</table>
<br />
<table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td width="34%"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><strong>How tight of tolerances do you need to hold?</strong> </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_3" type="radio" value="2" /> Very Tight </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_3" type="radio" value="2,3" /> Tight </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_3" type="radio" value="1" /> The tighter the better but it's not a big deal </span></span></td>
</tr>
</tbody>
</table>
<br />
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td width="34%"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><strong>Does minor heat matter in the case of your project?</strong> </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_4" type="radio" value="1,3" /> Yes, I can't have any heat in the mix </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_4" type="radio" value="1,2,3,4" /> No, it doesn't matter </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_4" type="radio" value="5" /> I'm not sure </span></span></td>
</tr>
</tbody>
</table>
<br />
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td width="34%"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><strong>How intricate are the details in your project?</strong> </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_5" type="radio" value="2,4" /> Very intricate and detailed </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_5" type="radio" value="1,2,3" /> It's detailed, but nothing too extreme </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_5" type="radio" value="1,3" /> Minor detail </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_5" type="radio" value="1,2,3,4" /> None, it's just a regular shape </span></span></td>
</tr>
</tbody>
</table>
<br />
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td width="34%"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><strong>Will your project require a fine finish, forming or other machining?</strong> </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_6" type="radio" value="2" /> Yes </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_6" type="radio" value="1,3" /> No </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_6" type="radio" value="5" /> Unsure </span></span></td>
</tr>
</tbody>
</table>
<br />
<table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td width="34%"><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><strong>Is your material white, or porous?</strong> </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_7" type="radio" value="3" /> Yes </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_7" type="radio" value="1,2,4" /> No </span></span></td>
</tr>
<tr>
<td><span style="font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-size: small;"><input name="question_7" type="radio" value="5" /> Unsure </span></span></td>
</tr>
</tbody>
</table>
<br /><input type="submit" value="Finish" /> <input type="reset" value="Reset" /> </form><!-- end quiz html -->