Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-08-2004, 11:57 PM   PM User | #1
dreamsonthefly
Regular Coder

 
Join Date: Nov 2003
Location: Seattle
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
dreamsonthefly is an unknown quantity at this point
Question Error line 168 line 1

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


<html>
<head>
<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+= "BUT, YOU MAY ONLY SUBMIT THE TEST ONE TIME!\n";
notice+= "You will now be redirected to Our Home Page.\n";
alert(notice);
window.location.replace('/');
}
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');
document.thedata.NAME.focus();
return false;
}
else {
document.senddata.NAME.value = name;
}
var contact = document.thedata.CONTACT.value;
if (!contact) {
alert('You must enter your e-mail address');
document.thedata.CONTACT.focus();
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;
document.senddata.action="http://pub7.bravenet.com/emailfwd/senddata.php"
document.senddata.submit();
}
}
// -->
</script>
</head>

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

<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<form name="result">
<input type="hidden" name="CORRECT" value="">
<table border="0" width="100%" cellpadding="0" height="116">
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<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>
</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</div>

<div align="center">
<center>
<p>
<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[1].value=totalquestions-incorrect.length+" out of "+totalquestions
document.result[3].value=(totalquestions-incorrect.length)/totalquestions*100+"%"
for (temp=0;temp<incorrect.length;temp++)
document.result[2].value+=incorrect[temp]+", "
correct = totalquestions-incorrect.length;
document.result.CORRECT.value = correct;
</script>
<form name="thnx">
<input type="button" value="Submit your answers by entering your information below" name="B1" onClick="location.replace('/');">
</form>


<!-- 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" />
</form>

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

<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 />
</form>
</div>

<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();">
</form>
</div>

<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>
</div>

</div>
</div>
<!-- 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>
</body>
</html>

Thank you.
__________________
Dreams on the Fly
http://www.dreamsonthefly.com
dreamsonthefly is offline   Reply With Quote
Old 01-09-2004, 12:22 AM   PM User | #2
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
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.
__________________
Moderator, Perl/CGI Forum
shadowstorm.net - subvert society
Feyd is offline   Reply With Quote
Old 01-09-2004, 12:23 AM   PM User | #3
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
And this probably needs to be moved to a more appropriate forum, this has little to do with serverside languages.
__________________
Moderator, Perl/CGI Forum
shadowstorm.net - subvert society
Feyd is offline   Reply With Quote
Old 01-09-2004, 12:26 AM   PM User | #4
dreamsonthefly
Regular Coder

 
Join Date: Nov 2003
Location: Seattle
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
dreamsonthefly is an unknown quantity at this point
IE vs NS

I am on IE 6.0. which forum would be more appropritae?
__________________
Dreams on the Fly
http://www.dreamsonthefly.com
dreamsonthefly is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:00 PM.


Advertisement
Log in to turn off these ads.