Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
msyerson@acument.com #1
Coursebuilder Quiz Summary page - HELP!!!
I need help figuring out why my quiz summary page does not show the results of
my quiz. Please help if you can. I will attach the code.
Navigation Page listed first then Summary Page listed next
<title>Navigation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language='JavaScript'>
<!--
function MM_setIntProps(jsStr) { //v1.0
eval(jsStr);
}
//--></script>
<script language='JavaScript' src='scripts/interactionClass.js'></script>
<script language='JavaScript' src='scripts/elemHotaClass.js'></script>
<script language='JavaScript' src='scripts/behDragLayer.js'></script>
<script language='JavaScript' src='scripts/behCourseBuilder.js'></script>
<script language='JavaScript' src='scripts/behActions.js'></script>
</head>
<body bgcolor="#FFFFFF" onLoad="MM_initInteractions()">
<script language="javascript">
<!--
// constructor for a quiz page object
function quizPage(src, tries, correct, completed) {
this.src = src
this.tries = (!tries) ? 0 : tries
this.correct = (!correct) ? 0 : correct
this.completed = (!completed) ? false : completed
}
// create array of all quiz pages in the entire quiz
var quiz = new Array()
/* ----------------------------------------------------------------
MODIFY THE CODE IN THE FOLLOWING SECTION.
This is where you define the parameters for each page of the
quiz, including introductory and summary pages.
Create a new entry in the quiz array by assigning a new
quizPage object to succeeding quiz array entries (starting with
zero). Parameters that must be set for the initial objects describe
the URL of the top frame page.
------------------------------------------------------------------ */
quiz[0] = new quizPage("multi_page_quiz_overview.htm")
quiz[1] = new quizPage("Untitled-1.htm")
quiz[2] = new quizPage("Untitled-2.htm")
quiz[3] = new quizPage("Untitled-3.htm")
quiz[4] = new quizPage("Untitled-4.htm")
quiz[5] = new quizPage("Untitled-5.htm")
quiz[6] = new quizPage("Untitled-6.htm")
quiz[7] = new quizPage("Untitled-7.htm")
quiz[8] = new quizPage("Untitled-8.htm")
quiz[9] = new quizPage("Untitled-9.htm")
quiz[10] = new quizPage("Untitled-10.htm")
quiz[11] = new quizPage("Untitled-11.htm")
quiz[12] = new quizPage("Untitled-12.htm")
quiz[13] = new quizPage("Untitled-13.htm")
quiz[14] = new quizPage("Untitled-14.htm")
quiz[15] = new quizPage("Untitled-15.htm")
quiz[16] = new quizPage("Untitled-16.htm")
quiz[17] = new quizPage("Untitled-17.htm")
quiz[18] = new quizPage("Untitled-18.htm")
quiz[19] = new quizPage("Untitled-19.htm")
quiz[20] = new quizPage("Untitled-20.htm")
quiz[21] = new quizPage("Untitled-21.htm")
quiz[22] = new quizPage("Untitled-22.htm")
quiz[23] = new quizPage("Untitled-23.htm")
quiz[24] = new quizPage("Untitled-24.htm")
quiz[25] = new quizPage("Untitled-25.htm")
quiz[26] = new quizPage("Untitled-26.htm")
quiz[27] = new quizPage("multi_page_quiz_summary4.htm")
/* -----------------------------------------------------------------
END CODE MODIFICATION SECTION
-----------------------------------------------------------------*/
// navigate to next quiz page in sequence
function goNext() {
var currPage, i
for (i=0; i<(quiz.length-1); i++) {
if (parent.main.location.href.indexOf(quiz[i].src) != -1) {
parent.main.location.href = quiz[i+1].src
break
}
}
}
// navigate to previous quiz page in sequence
function goPrev() {
var currPage, i
for (i=(quiz.length-1); i>0; i--) {
if (parent.main.location.href.indexOf(quiz[i].src) != -1) {
parent.main.location.href = quiz[i-1].src
break
}
}
}
// navigate to first quiz page in sequence
function goFirst() {
parent.main.location.href = quiz[0].src
}
// navigate to last quiz page in sequence
function goLast() {
parent.main.location.href = quiz[quiz.length-1].src
}
// don't go anywhere, but set visibility of navigation control
// layers in the event of a page reload
function initPage() {
var i, storage
storage = document.forms["persistence"].persist.value
if (storage) {
restoreQuizObjects(storage)
}
for (i=0; i<(quiz.length); i++) {
if (parent.main.location.href.indexOf(quiz[i].src) != -1) {
break
}
}
}
// event handler for Navigator frame resize/reload
function handleNNResize() {
var NS = (navigator.appName.indexOf("Netscape") != -1)
if (NS) {
history.go(0)
}
}
// restoration of data from persistent storage
// using a text field in the nav frame for storage
function restoreQuizObjects(storage) {
var quizzes, p
quizzes = storage.split(":")
for (var i = 0; i < quizzes.length-1; i++) {
if (quizzes[i]) {
p = quizzes[i].split(",")
quiz[i] = new quizPage(parseInt(p[1]), p[2], parseInt(p[3]),
parseInt(p[4]), parseInt(p[5]), parseInt(p[6]), parseInt(p[7]), parseInt(p[8]),
parseInt(p[9]), parseInt(p[10]), parseInt(p[11]), parseInt(p[12]),
parseInt(p[13]), parseInt(p[14]), parseInt(p[15]), parseInt(p[16]),
parseInt(p[17]), parseInt(p[18]), parseInt(p[19]), parseInt(p[20]),
parseInt(p[21]), parseInt(p[22]), parseInt(p[23]), parseInt(p[24]),
parseInt(p[25]), parseInt(p[26]), p[27])
}
}
saveQuizObjects()
}
// saving quiz object data in persistent storage
// using a text field in the nav frame for storage
function saveQuizObjects() {
var oneQuiz = new Array(), storage = ""
for (var i = 0; i < quiz.length; i++) {
for (j in quiz[i]) {
oneQuiz[oneQuiz.length] = quiz[i][j]
}
storage += (oneQuiz) ? oneQuiz.join() + ":" : ""
oneQuiz.length = 0
}
if (document.forms["persistence"]) {
document.forms["persistence"].persist.value = storage
}
}
// pass along value of KO tries to quiz page object
function setTries(URL, tries) {
var obj = findPage(URL)
obj.tries = tries
if (document.forms["triesForm"]) {
document.forms["triesForm"].tries.value = obj.tries
}
saveQuizObjects()
}
// set completed property of a quiz object
function setAsDone(URL) {
var obj = findPage(URL)
obj.completed = true
saveQuizObjects()
}
// pass along values of score to quiz page object
function setCorrect(URL, correct) {
var obj = findPage(URL)
obj.correct = correct
saveQuizObjects()
}
// reset tries and score property settings for a quiz object
function resetObject(URL) {
var obj = findPage(URL)
obj.tries = 0
var triesFld = MM_intFindObject("tries")
triesFld.value = obj.correct
saveQuizObjects()
}
// locate the quiz object for a given quiz URL
// (invoked by init() function of each quiz page)
function findPage(URL) {
var currPage, i
for (i=0; i<(quiz.length); i++) {
if (URL.indexOf(quiz[i].src) != -1) {
return quiz[i]
}
}
return quiz[0]
}
//-->
</script>
<interaction object="G01" name="navigation"
includesrc="interactionClass.js,elemHotaClass.js,b ehDragLayer.js">
<div name="G01Layer">
<!-- Copyright 1998 Macromedia, Inc. All rights reserved. -->
<span name="G01question"> </span> </div>
<div id="G01Next" style="position:absolute; left:144px; top:14px; width:65px;
height:65px; z-index:2; visibility: visible"> <a href="#"><img
src="images_dg/next.gif" name="G01NextImg" width="65" height="65"
border="0"></a></div>
<script language="JavaScript">
<!--
function newG01() {
G01 = new MM_interaction('G01',1,0,0,null,0,0,0,'','','c','' ,0);
G01.add('hota','Next',0,1,null,0);
G01.init();
G01.am('segm','Next Feedback_',1,0);
G01.am('cond','Next Selected_','G01.e[\'Next\'].selected == true',0);
G01.am('actn','Call JavaScript','MM_callJS(\'goNext()\')','cjs');
G01.am('end');
G01.am('segm','Correct Handling_',1,1);
G01.am('cond','Interaction is Correct_','G01.correct == true',0);
G01.am('end');
G01.am('segm','Incorrect Handling_',1,1);
G01.am('cond','Interaction is Incorrect_','G01.correct == false',0);
G01.am('end');
G01.am('segm','Handle all other clicks_',1,1);
G01.am('cond','Unknown Response_','G01.knownResponse == false',0);
G01.am('end');
G01.am('segm','Check Tries_',1,1);
G01.am('cond','Tries Exceeded_','G01.triesAtLimit == true',0);
G01.am('end');
}
if (window.newG01 == null) window.newG01 = newG01;
if (!window.MM_initIntFns) window.MM_initIntFns = ''; window.MM_initIntFns
+= 'newG01();';
//-->
</script>
<cbi-select object="G01"></interaction>
<DIV ID="triesLayer" STYLE="position:absolute; width:247px; height:48px;
z-index:3; left: 9px; top: 5px; visibility: hidden">
<FORM NAME="persistence" METHOD="post" ACTION="">
<BR>
<INPUT TYPE="text" NAME="persist" SIZE="80">
</FORM>
<FORM NAME="triesForm" METHOD="post" ACTION="">
Number of tries for this question:
<INPUT TYPE="text" NAME="tries" SIZE="4" VALUE="0">
</FORM>
</DIV>
</body>
</html>
______________________________________________
Now the code for the Summary page
___________________________________________
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
// Make copy of quiz object from navigation bar at load time.
var quiz = parent.nav.quiz
// Functions that provide quiz-related data to be dynamically written
// to the summary page
// Returns the question number of tries recorded by the knowledge object
function getTries(i) {
return quiz[i].tries
}
// Returns the question score recorded by the knowledge object
function getCorrect(i) {
return quiz[i].correct
}
//-->
</SCRIPT>
</HEAD>
<body bgcolor="#FFFFFF">
<H1><font face="Arial, Helvetica, sans-serif" size="4">Quiz Results</font></H1>
<P><font face="Arial, Helvetica, sans-serif" size="2">Here are the results of
your test.
<TABLE BORDER="1" WIDTH="75%" ALIGN="CENTER">
<TR>
<TH BGCOLOR="#66FFFF"><font face="Arial,
msyerson@acument.com Guest
-
Coursebuilder - Quiz
i have designed a 12-question, multiple choice quiz using the coursebuilder extension. i've defined scores for each answer (all A answers are 1... -
Can't Change Page Size in Print Summary - Illustrator CS on Windows XP
Just bought Illustrator CS for my PC running Windows XP. Everything is working fine EXCEPT no matter what page size I set for my document, when I go... -
Need help with quiz
Hi All, I am new to Director and I want to develop a quiz with protected cast members with all questions protected in a single file. I want to know... -
Quiz Quiz Quiz but how to customise??
Hi all, I am having a bit of a blonde moment here. I need a quiz quickly and have got a source file from ... -
Summary fields or Summary table?
First posting to the group - thanks to everyone for all the great tips! Is there any advantage either way between having a large number of...



Reply With Quote

