View Full Version : Error line 168 line 1

01-09-2004, 12:57 AM
I (with the help of members on this site) have developed a quiz via javascriptkt. It worked for w while and now the only thing missing is the submission of the results to me. The results show up on the form page, I put in the correct data to submit, but when I hit the submit button, it does not submit and gives me an error msg.

My question is: Does the error msg. (line 168) directly correspond with the line in the script? And do you count every line, even those that have nothing on them. Below is the script. Any help would be appreciated as this is the last link to sending out a newsletter with a link to the quiz.

The link is http://www.dreamsonthefly.com/januaryquiz.html

<title>December Quiz</title>
<script type="text/javascript" src="quizconfig.js"></script>
function setCookie() {
duit = new Date();
duit.setTime(duit.getTime() + 30*24*60*60*1000);
var expString = "; expires=" + duit.toGMTString();
document.cookie = document.title + expString;

function submitData() {
var dc = document.cookie;
if(dc.match(document.title)) {
notice = "Thank You for your interest in taking our "+document.title+".\n";
notice+= "You will now be redirected to Our Home Page.\n";
else {
var correct = document.result.CORRECT.value;
var sub = correct+ ' correct answers on your December Test!';
var name = document.thedata.NAME.value;
if (!name) {
alert('You must enter your name');
return false;
else {
document.senddata.NAME.value = name;
var contact = document.thedata.CONTACT.value;
if (!contact) {
alert('You must enter your e-mail address');
return false;
else {
document.senddata.CONTACT.value = contact;
var from = document.thedata.FROM.value;
if (!from) {
from = 'No Data Submitted';
document.senddata.FROM.value = from;
else {
document.senddata.FROM.value = from;
var comment = document.thedata.COMMENT.value;
if (!comment) {
comment = 'No Comments Made.';
document.senddata.COMMENT.value = comment;
else {
document.senddata.COMMENT.value = comment;
document.senddata.PERCENTAGE.value = document.result.q.value;
document.senddata.CORRECT_ANSWERS.value = document.result.p.value;
document.senddata.WRONG_ANSWERS.value = document.result.T2.value;
// -->

<body bgcolor="#FFFFFF" onunload="setCookie()">
<p align="center"><strong><font face="Arial">
<big>Instant Quiz Results</big></font></strong></p>

<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<td width="100%">
<form name="result">
<input type="hidden" name="CORRECT" value="">
<table border="0" width="100%" cellpadding="0" height="116">
<td height="25" bgcolor="#DBE0F5"><strong><font face="Arial"># of questions you got right:</font></strong></td>
<td height="25"><p><input type="text" name="p" size="24"></td>
<td height="17" bgcolor="#DBE0F5"><strong><font face="Arial">The questions you got wrong:</font></strong></td>
<td height="17"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
<td height="25" bgcolor="#DBE0F5"><strong><font face="Arial">Grade in percentage:</font></strong></td>
<td height="25"><input type="text" name="q" size="8"></td>

<div align="center">
<script type="text/javascript">
var wrong=0
for (e=0;e<=2;e++)

var results=document.cookie.split(";")
for (n=0;n<=results.length-1;n++){
if (results[n].charAt(1)=='q')

var incorrect=results[parse].split("=")
if (incorrect[incorrect.length-1]=='b')
document.result[1].value=totalquestions-incorrect.length+" out of "+totalquestions
for (temp=0;temp<incorrect.length;temp++)
document.result[2].value+=incorrect[temp]+", "
correct = totalquestions-incorrect.length;
document.result.CORRECT.value = correct;
<form name="thnx">
<input type="button" value="Submit your answers by entering your information below" name="B1" onClick="location.replace('/');">

<!-- Start Bravenet.com Service Code -->
<div align=center>

<div style="border:1px solid #999999; width:255px; margin-bottom:5px;background-color:#F2F4FA;">
<form name="senddata" method="post" enctype="multipart/form-data" style="margin:0px;">
<input type="hidden" name="NAME" value="" />
<input type="hidden" name="CONTACT" value="" />
<input type="hidden" name="FROM" value="" />
<input type="hidden" name="COMMENT" value="" />
<input type="hidden" name="PERCENTAGE" value="" />
<input type="hidden" name="CORRECT_ANSWERS" value="" />
<input type="hidden" name="WRONG_ANSWERS" value="" />
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
<input type="hidden" name="usernum" value="587815930" />
<input type="hidden" name="cpv" value="2" />

<div style="background-color:#DBE0F5; padding:3px; font:12px arial; color:black;">
<b>Your Answers will submit automatically when you complete this form</b>

<form name="thedata">
<div style="padding:10px; font: normal 12px Arial; text-align:left;">
What is your name?<br />
<input type="text" name="NAME" size="34" style="width:230px;" /><br />
E-mail address?<br />
<input type="text" name="CONTACT" size="34" style="width:230px;" /><br />
Where are you from?<br />
<input type="text" name="FROM" size="34" style="width:230px;" /><br />
Any Comments?<br />
<input type="text" name="COMMENT" size="34" style="width:230px;" /><br />

<div align="center">
<form name="datasubmit">
<input type="button" name="send" value=" Submit" onClick="submitData();">
<input type="button" name="reset" value=" Clear " onClick="document.thedata.reset();">

<div align="center" style="margin:10px;">
<a style="font: bold 10px tahoma,arial; text-decoration: none;"
href="http://www.bravenet.com" target="_new">
powered&nbsp;by&nbsp;<img src="http://images.bravenet.com/bravenet/images/poweredby.gif"
border="0" align="absmiddle" alt="Powered by Bravenet" />&nbsp;bravenet.com</a>

<!-- End Bravenet.com Service Code --></div>

<p id="footnote" align="center"><font face="arial" size="-1">Quiz script provided by<br>
<a href="http://www.javascriptkit.com">JavaScriptKit.com</a></font></p>

Thank you.

01-09-2004, 01:22 AM
Are you testing getting this error in Netscape's javascript console (which is much better)? Or IE? IE will often incorrectly give you a line number that is far off due to an included JS, where NS's javascript console will tell you if the error is in the JS (it will say error in quizconfig.js and its line) or if it is in the actual page.

01-09-2004, 01:23 AM
And this probably needs to be moved to a more appropriate forum, this has little to do with serverside languages.

01-09-2004, 01:26 AM
I am on IE 6.0. which forum would be more appropritae?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum