Javascript for an online quiz...

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Dec 2008
Posts: 59
Reputation: Techie08 is an unknown quantity at this point 
Solved Threads: 0
Techie08's Avatar
Techie08 Techie08 is offline Offline
Junior Poster in Training

Javascript for an online quiz...

 
0
  #1
Aug 31st, 2009
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&nbsp;when you&nbsp;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...)&nbsp; </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 -->
"The only thing we don't cut is corners."
Sarah
www.fedtech.com
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 317
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: Javascript for an online quiz...

 
0
  #2
Sep 1st, 2009
You need to put the name of the form so change the form tag to include name="quiz" like this:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <form name="quiz" action="javascript:finish();" enctype="application/x-www-form-urlencoded" method="get">
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 59
Reputation: Techie08 is an unknown quantity at this point 
Solved Threads: 0
Techie08's Avatar
Techie08 Techie08 is offline Offline
Junior Poster in Training

Re: Javascript for an online quiz...

 
0
  #3
Sep 1st, 2009
Originally Posted by Thirusha View Post
You need to put the name of the form so change the form tag to include name="quiz" like this:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <form name="quiz" action="javascript:finish();" enctype="application/x-www-form-urlencoded" method="get">
Do i put this at the end, or the beginning? Thanks!!
"The only thing we don't cut is corners."
Sarah
www.fedtech.com
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 59
Reputation: Techie08 is an unknown quantity at this point 
Solved Threads: 0
Techie08's Avatar
Techie08 Techie08 is offline Offline
Junior Poster in Training

Re: Javascript for an online quiz...

 
0
  #4
Sep 1st, 2009
Crap. Well i tried both but neither worked at the beginning or the end
"The only thing we don't cut is corners."
Sarah
www.fedtech.com
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 317
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: Javascript for an online quiz...

 
0
  #5
Sep 1st, 2009
You just replace the form tag that u have.
Here is the entire code i used, i have only tested it in firefox
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <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>
  2. <p><span style="font-size: small;">The Cutting Method Assessment is the perfect tool to help you decide which path to take&nbsp;when you&nbsp;start manufacturing your parts.</span></p>
  3. <!-- begin quiz script -->
  4. <script type="text/javascript"><!--
  5. function finish() {
  6. var ext = '.html';
  7. var results = new Array("none","Waterjet Cutting","Laser Cutting","Water-Only Cutting","Machining or Value-Added","You're Out of Luck");
  8. var nums = new Array(6);
  9. for(var i = 0; i < nums.length; i++) nums[i] = 0;
  10. for(var i = 1; i <= 7; i++) {
  11. var q = document.forms['quiz'].elements['question_'+i];
  12. if(q[0].type=='checkbox') {
  13. var n = 0;
  14. }
  15. for(var j = 0; j < q.length; j++) {
  16. if(q[j].checked) {
  17. var a = q[j].value.split(',');
  18. for(var k = 0; k < a.length; k++) {
  19. nums[a[k]]++;
  20. }
  21. if(q[j].type=='radio') break;
  22. else n++;
  23. }
  24. if(j == q.length-1&&q[j].type=='radio') {nums[0]++;}
  25. }
  26. 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]++;
  27. }
  28. var j = new Array('0');
  29. 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;
  30. //var o = '';for(var i in results)o+=results[i]+'='+nums[i]+'\n';
  31. //alert(o);
  32. if(nums[0]!=0) {
  33. alert('You missed or incorrectly answered '+nums[0]+' questions!');
  34. }
  35. else if(j[0]==0) {
  36. alert('No result could be determined.');
  37. }
  38. else {
  39. location = results[j[0]]+ext;
  40. }
  41. }
  42. // --></script>
  43. <!-- end quiz script --><!-- begin quiz html --><form name="quiz" action="javascript:finish();" enctype="application/x-www-form-urlencoded" method="get">
  44. <table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
  45. <tbody>
  46. <tr>
  47. <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>
  48. </tr>
  49. <tr>
  50. <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>
  51. </tr>
  52. <tr>
  53. <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>
  54. </tr>
  55. <tr>
  56. <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>
  57. </tr>
  58. <tr>
  59. <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>
  60. </tr>
  61. <tr>
  62. <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>
  63. </tr>
  64. <tr>
  65. <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>
  66. </tr>
  67. <tr>
  68. <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>
  69. </tr>
  70. <tr>
  71. <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>
  72. </tr>
  73. <tr>
  74. <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>
  75. </tr>
  76. <tr>
  77. <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...)&nbsp; </span></span></td>
  78. </tr>
  79. </tbody>
  80. </table>
  81. <br />
  82. <table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
  83. <tbody>
  84. <tr>
  85. <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>
  86. </tr>
  87. <tr>
  88. <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>
  89. </tr>
  90. <tr>
  91. <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>
  92. </tr>
  93. <tr>
  94. <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>
  95. </tr>
  96. <tr>
  97. <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>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <br />
  102. <table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
  103. <tbody>
  104. <tr>
  105. <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>
  106. </tr>
  107. <tr>
  108. <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>
  109. </tr>
  110. <tr>
  111. <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>
  112. </tr>
  113. <tr>
  114. <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>
  115. </tr>
  116. </tbody>
  117. </table>
  118. <br />
  119. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  120. <tbody>
  121. <tr>
  122. <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>
  123. </tr>
  124. <tr>
  125. <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>
  126. </tr>
  127. <tr>
  128. <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>
  129. </tr>
  130. <tr>
  131. <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>
  132. </tr>
  133. </tbody>
  134. </table>
  135. <br />
  136. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  137. <tbody>
  138. <tr>
  139. <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>
  140. </tr>
  141. <tr>
  142. <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>
  143. </tr>
  144. <tr>
  145. <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>
  146. </tr>
  147. <tr>
  148. <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>
  149. </tr>
  150. <tr>
  151. <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>
  152. </tr>
  153. </tbody>
  154. </table>
  155. <br />
  156. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  157. <tbody>
  158. <tr>
  159. <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>
  160. </tr>
  161. <tr>
  162. <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>
  163. </tr>
  164. <tr>
  165. <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>
  166. </tr>
  167. <tr>
  168. <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>
  169. </tr>
  170. </tbody>
  171. </table>
  172. <br />
  173. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  174. <tbody>
  175. <tr>
  176. <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>
  177. </tr>
  178. <tr>
  179. <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>
  180. </tr>
  181. <tr>
  182. <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>
  183. </tr>
  184. <tr>
  185. <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>
  186. </tr>
  187. </tbody>
  188. </table>
  189. <br /><input type="submit" value="Finish" /> <input type="reset" value="Reset" /> </form><!-- end quiz html -->
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 59
Reputation: Techie08 is an unknown quantity at this point 
Solved Threads: 0
Techie08's Avatar
Techie08 Techie08 is offline Offline
Junior Poster in Training

Re: Javascript for an online quiz...

 
0
  #6
Sep 1st, 2009
Okay, i replaced it with what you had there. But it takes me to my 404 page when you click 'Finish', the page extensions should be:
http://www.fedtech.com/waterjet-cutting
http://www.fedtech.com/laser-cutting
http://www.fedtech.com/water-only

for the results landing pages..

but you got me much closer to where i need to be! thanks!
Last edited by Techie08; Sep 1st, 2009 at 10:43 am.
"The only thing we don't cut is corners."
Sarah
www.fedtech.com
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 317
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: Javascript for an online quiz...

 
0
  #7
Sep 1st, 2009
404 normally means that a page doesnt exist.
i think if u remove this part of the code then it should work:
towards the end of the javascript code locate this line:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. location = results[j[0]]+ext;
replace that line with this one:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. location = results[j[0]];

also ensure that the names in the array are the same as where u want them to go for example i can see in the code that you have to change the name in the array(var results), where u see "Waterjet Cutting" to "waterjet-cutting"
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 59
Reputation: Techie08 is an unknown quantity at this point 
Solved Threads: 0
Techie08's Avatar
Techie08 Techie08 is offline Offline
Junior Poster in Training

Re: Javascript for an online quiz...

 
0
  #8
Sep 1st, 2009
Alright. So i made those adjustments... here is the final script but it's still not going to those pages? Maybe i goofed.

<h1>Cutting Method Assessment</h1>
<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&nbsp;when you&nbsp;start manufacturing your parts.</span></p>
<!-- begin quiz script -->
<script type="text/javascript"><!--
function finish() for(var j = 0; j < q.length; j++) if(q[j].type=='radio') break;
else n++;
}
if(j == q.length-1&&q[j].type=='radio') }
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]]) 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) else if(j[0]==0) else }
// --></script>
<!-- end quiz script --><!-- begin quiz html --><form action="javascript&lt;b&gt;&lt;/b&gt;: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...)&nbsp; </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 --><br />
</div>
<!--PAGE_END-->
"The only thing we don't cut is corners."
Sarah
www.fedtech.com
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 317
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: Javascript for an online quiz...

 
0
  #9
Sep 2nd, 2009
Please use the code tags when inserting code, just makes it look neater.

Also i see you have removed some stuff in the javascript code, use this code:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <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>
  2. <p><span style="font-size: small;">The Cutting Method Assessment is the perfect tool to help you decide which path to take&nbsp;when you&nbsp;start manufacturing your parts.</span></p>
  3. <!-- begin quiz script -->
  4. <script type="text/javascript"><!--
  5. function finish() {
  6. var ext = '.html';
  7. var results = new Array("none","waterjet-cutting","laser-cutting","water-only","Machining or Value-Added","You're Out of Luck");
  8. var nums = new Array(6);
  9. for(var i = 0; i < nums.length; i++) nums[i] = 0;
  10. for(var i = 1; i <= 7; i++) {
  11. var q = document.forms['quiz'].elements['question_'+i];
  12. if(q[0].type=='checkbox') {
  13. var n = 0;
  14. }
  15. for(var j = 0; j < q.length; j++) {
  16. if(q[j].checked) {
  17. var a = q[j].value.split(',');
  18. for(var k = 0; k < a.length; k++) {
  19. nums[a[k]]++;
  20. }
  21. if(q[j].type=='radio') break;
  22. else n++;
  23. }
  24. if(j == q.length-1&&q[j].type=='radio') {nums[0]++;}
  25. }
  26. 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]++;
  27. }
  28. var j = new Array('0');
  29. 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;
  30. //var o = '';for(var i in results)o+=results[i]+'='+nums[i]+'\n';
  31. //alert(o);
  32. if(nums[0]!=0) {
  33. alert('You missed or incorrectly answered '+nums[0]+' questions!');
  34. }
  35. else if(j[0]==0) {
  36. alert('No result could be determined.');
  37. }
  38. else {
  39. location = results[j[0]];
  40. }
  41. }
  42. // --></script>
  43. <!-- end quiz script --><!-- begin quiz html --><form name="quiz" action="javascript:finish();" enctype="application/x-www-form-urlencoded" method="get">
  44. <table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
  45. <tbody>
  46. <tr>
  47. <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>
  48. </tr>
  49. <tr>
  50. <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>
  51. </tr>
  52. <tr>
  53. <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>
  54. </tr>
  55. <tr>
  56. <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>
  57. </tr>
  58. <tr>
  59. <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>
  60. </tr>
  61. <tr>
  62. <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>
  63. </tr>
  64. <tr>
  65. <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>
  66. </tr>
  67. <tr>
  68. <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>
  69. </tr>
  70. <tr>
  71. <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>
  72. </tr>
  73. <tr>
  74. <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>
  75. </tr>
  76. <tr>
  77. <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...)&nbsp; </span></span></td>
  78. </tr>
  79. </tbody>
  80. </table>
  81. <br />
  82. <table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
  83. <tbody>
  84. <tr>
  85. <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>
  86. </tr>
  87. <tr>
  88. <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>
  89. </tr>
  90. <tr>
  91. <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>
  92. </tr>
  93. <tr>
  94. <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>
  95. </tr>
  96. <tr>
  97. <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>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <br />
  102. <table style="background-color: #ffffff; width: 100%; border: #ffffff 0px solid;" border="0" cellspacing="0" cellpadding="5">
  103. <tbody>
  104. <tr>
  105. <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>
  106. </tr>
  107. <tr>
  108. <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>
  109. </tr>
  110. <tr>
  111. <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>
  112. </tr>
  113. <tr>
  114. <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>
  115. </tr>
  116. </tbody>
  117. </table>
  118. <br />
  119. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  120. <tbody>
  121. <tr>
  122. <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>
  123. </tr>
  124. <tr>
  125. <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>
  126. </tr>
  127. <tr>
  128. <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>
  129. </tr>
  130. <tr>
  131. <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>
  132. </tr>
  133. </tbody>
  134. </table>
  135. <br />
  136. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  137. <tbody>
  138. <tr>
  139. <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>
  140. </tr>
  141. <tr>
  142. <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>
  143. </tr>
  144. <tr>
  145. <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>
  146. </tr>
  147. <tr>
  148. <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>
  149. </tr>
  150. <tr>
  151. <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>
  152. </tr>
  153. </tbody>
  154. </table>
  155. <br />
  156. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  157. <tbody>
  158. <tr>
  159. <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>
  160. </tr>
  161. <tr>
  162. <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>
  163. </tr>
  164. <tr>
  165. <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>
  166. </tr>
  167. <tr>
  168. <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>
  169. </tr>
  170. </tbody>
  171. </table>
  172. <br />
  173. <table style="width: 100%;" border="0" cellspacing="0" cellpadding="5">
  174. <tbody>
  175. <tr>
  176. <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>
  177. </tr>
  178. <tr>
  179. <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>
  180. </tr>
  181. <tr>
  182. <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>
  183. </tr>
  184. <tr>
  185. <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>
  186. </tr>
  187. </tbody>
  188. </table>
  189. <br /><input type="submit" value="Finish" /> <input type="reset" value="Reset" /> </form><!-- end quiz html -->

Were u still getting 404 errors after u edited the code, or did it completely break?
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 59
Reputation: Techie08 is an unknown quantity at this point 
Solved Threads: 0
Techie08's Avatar
Techie08 Techie08 is offline Offline
Junior Poster in Training

Re: Javascript for an online quiz...

 
0
  #10
Sep 2nd, 2009
I used that code, you can see it on the page:
www.fedtech.com/cutting-quiz

but it still doesn't redirect.. its beyond me as to why!
"The only thing we don't cut is corners."
Sarah
www.fedtech.com
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC