xelawho helped me learn more about JavaScript syntax for an online quiz i have and the quiz is almost there except for it's target audience on the iPad. It's using code from JavaScriptKit (from 2003) and cleaning up the syntax has it working on IE9, FF, and Chrome but not on Safari. There's a results page which just stays blank on Safari.

This quiz helps learners see what they know and isn't used for grading (so it's okay that they can find the answers in a JS file).

I'm pretty sure it's a syntax issue causing the issue, maybe even a comma, because it works fine in those other browsers.

I'd like to know what and why and not just get a simple fix so that I can better learn JavaScript since it's becoming part of my daily tool set (I stopped using Flash a month ago and am doing JS, CSS, and HTML5).

Any help and insight would be great, thanks!

Here's a temp link: popquiz

and here's the the code (the main html is rather long and had to be shortened for here) for the popquiz.htm page:
HTML Code:
<!doctype html>
<!--[if IE] >< ![endif]--> <!-- prevents IE from downloading only one file at a time -->
<html>
<head>
<style>
.qheader{
	font:bold;
	padding-top:10px;
	padding-bottom: 10px;
}
.qselections{
	font:normal;
	line-height: 2em;
	padding-left: 20px;
}
</style>
<script src="scripts/quizconfig.js"></script>
<script type="text/javascript">
var actualchoices=new Array();
	document.cookie="ready=yes";
</script>
	<link rel="stylesheet" type="text/css" href="scripts/style96x.css" /> 
    
<!--  JavaScriptKit.com Multiple Choice Quiz Script (http://www.javascriptkit.com)
Copyright 2003 JavaScript Kit- http://www.javascriptkit.com -->

</head>
<body>
<div id="wrap">
	<div id="main">

<form method="POST" name="myquiz">

<h3>Delphi The Basics Course (9.6) Quiz</h3>
<hr />
<div class="qheader">
1. From the Account Selection window, you can tell Delphi to search by clicking the Search button or:
</div>
<div class="qselections">
<input type="radio" value="a" name="question1" /> 
<font color="#33CC00">By pressing the ENTER key. <<</font><br />
<input type="radio" value="b" name="question1" /> 
By pressing the TAB key.<br />
<input type="radio" value="c" name="question1" /> 
By right-clicking in the Account Selection window and selecting Search.<br />
<input type="radio" value="d" name="question1" /> 
The only way to tell Delphi to search is by clicking the Search button.<br />
</div>

<br />

<div class="qheader">
2. In the Account Manager, where would you enter information, such as, &quot;<em>This account typically selects properties in the Southwest because it is a convenient location for all of their offices</em>&quot;?
</div>
<div class="qselections">
<img src="images/desert.jpg" width="259" height="100" align="right" /><input type="radio" value="a" name="question2" /> 
<font color="#33CC00">Account Comment window &lt;&lt;</font><br />
<input type="radio" value="b" name="question2" /> 
User Defined Fields<br />
<input type="radio" value="c" name="question2" /> 
In the Details folder<br />
<input type="radio" value="d" name="question2" /> 
Nowhere. You'd write the information on paper and keep it at your desk.<br />
</div>

<br />

<div class="qheader">
3. Select all of the fields from the Details folder that will carry over to bookings.
</div>
<div class="qselections">
<input type="radio" value="a" name="question3" />
Catering Manager, Service Manager, and Transient Manager)<br />
<input type="radio" value="b" name="question3" />
Catering Manager and Service Manager<br />
<input type="radio" value="c" name="question3" />
<font color="#33CC00">Catering Manager, Service Manager, and Lead Source &lt;&lt;</font><br />
<input type="radio" value="d" name="question3" />
Service Manager and Lead Source<br />
</div>

<br />

<div class="qheader">
4. In order for the postal code feature to work in Delphi, what field(s) must be left blank?
</div>
<div class="qselections">
<input type="radio" value="a" name="question4" /> 
<img src="images/state.png" width="325" height="83" align="right">
<font color="#33CC00">City and State &lt;&lt;</font><br />
<input type="radio" value="b" name="question4" /> 
City<br />
<input type="radio" value="c" name="question4" /> 
Country<br />
<input type="radio" value="d" name="question4" /> 
City, State, Country<br />
</div>

<br />

<div class="qheader">
5. Click the _____________ button if you want to search for a booking.
</div>
<div class="qselections">
<input type="radio" value="a" name="question5" /> 
<img src="images/question5.png" width="423" height="78" align="right" />New<br />
<input type="radio" value="b" name="question5" /> 
<font color="#33CC00">Open &lt;&lt;</font><br />
<input type="radio" value="c" name="question5" /> 
Activity<br />
<input type="radio" value="d" name="question5" />
Quick Booking<br />
</div>

<!- bah, too many lines for the forum (and anyone else!) - there are another 5 questions that go here -->

</form>

<p>&nbsp;</p>

<div>
<form>
<input type="button" value="Grade this quiz" name="B1" onClick="gradeit()" /> <input type="button" value="Reset" name="B2" onClick="document.myquiz.reset()" />
</form>
</div>

	</div>
</div>
</body>
</html>
here's the JavaScript file:

Code:
// JavaScript Document
// JavaScriptKit.com Multiple Choice Quiz Script (http://www.javascriptkit.com)
// Copyright 2003 JavaScript Kit- http://www.javascriptkit.com
///////////////////////////////
// total questions
var totalquestions=10
///////////////////////////////
// answers to each
var correctchoices=new Array()
correctchoices[1]='a'
correctchoices[2]='a'
correctchoices[3]='c'
correctchoices[4]='a'
correctchoices[5]='b'
correctchoices[6]='b'
correctchoices[7]='b'
correctchoices[8]='d'
correctchoices[9]='b'
correctchoices[10]='a'
///////////////////////////////
// quiz function
///////////////////////////////
function gradeit(){
var incorrect=null;
for (q=1;q<=totalquestions;q++){
	var thequestion=eval("document.myquiz.question"+q);
	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true)
			actualchoices[q]=thequestion[c].value;
			}
		if (actualchoices[q]!=correctchoices[q]){
			if (incorrect==null) {
				incorrect=q;
				} else {
					incorrect+="/"+q;
				}
			}
		}
		if (incorrect==null)
			incorrect="a/b";
			document.cookie='q='+incorrect;
		if (document.cookie=='')
			alert("Your browser does not accept cookies. Please adjust your browser settings.");
		else
			window.location="results.htm";
}
and here's the results.htm:

HTML Code:
<!doctype html>
<!--[if IE] >< ![endif]--> <!-- prevents IE from downloading only one file at a time -->
<html>
<head>
 	<meta charset="utf-8"> <!-- needs to be in first 1024 bytes for IE -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- force latest IE engine if multiple exist, error in validator but ok from boilerplate -->	
	<meta name="viewport" content="width=1024" /> 
	<meta name="description" content="Outstanding eLearning for Newmarket International solutions." />
	<meta name="keywords" content="Newmarket, eLearning, sales, catering" />
	<title>Newmarket eLearning</title>
<link rel="stylesheet" type="text/css" href="scripts/style96x.css"/> 
</head>

<body>

<div id="wrap">
	<div id="main">

<script src="scripts/quizconfig.js"></script>

<h3>Delphi The Basics Course Quiz (9.6) Results</h3></p>

<form method="POST" name="result">
       <div>Questions correct:<br />
       <input type="text" name="p" size="24" />
       </div>
       <div>Incorrect questions:<br />
        <textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea />
        </div>
       <div>Grade %:<br />
         <input type="text" name="q" size="8" />
         </div>
    </form>

<form method="POST">

<script type="text/javascript">
var wrong=0;
	for (e=0;e<=2;e++)
		document.result[e].value="";
var results=document.cookie.split(";");
	for (n=0;n<=results.length-1;n++){
		if (results[n].charAt(1)=='q')
			parse=n;
}
var incorrect=results[parse].split("=");
	incorrect=incorrect[1].split("/");
	if (incorrect[incorrect.length-1]=='b')
		incorrect="";
		document.result[0].value=totalquestions-incorrect.length+" out of "+totalquestions;
		document.result[2].value=(totalquestions-incorrect.length)/totalquestions*100+"%";
	for (temp=0;temp<incorrect.length;temp++) {
		document.result[1].value+=incorrect[temp]+", ";
	}
</script>

<input type="button" value="Take the quiz again" name="B1" onClick="history.go(-1)" />

</form>

</div>
</div>
</body>
</html>
phew and thanks! =)