I am a newbie to javascript so please bear with me...
I have a set of html pages that is actually a quiz that the end user takes. They were developed by someone other than I using Coursebuilder. The page consists of three frames. A master navigation frame, the main frame where the quiz takes place and a navigation frame for the quiz itself, which consists merely of the next button. What I am trying to so is to pull out the total score of the quiz, except I cannot figure out the container it is in.
Here is the main page code:
<html>
<head>
<title>Accounts Payable Score</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript"></script>
<script language="JavaScript" src="../inv_quiz/scripts/behActions.
js"></script>
<script language="JavaScript" src="../inv_quiz/scripts/behCourseBuilder.
js"></script>
<script language="JavaScript" src="../inv_quiz/scripts/interactionClass.
js"></script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<script language="JavaScript">
<!--
<!-- hide from JavaScript-challenged browsers
function openWindow(url) {
popupWin = window.open(url, 'lesson', 'menubar=no,toolbar=no,location=no,directories=no, status=no,scrollbars=yes,resizable=no,dependent,wi dth=780,height=510,left=5,top=25')
}
// done hiding -->
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<SCRIPT LANGUAGE=VBSCRIPT SRC="3web.vbs"></SCRIPT>
<link rel="stylesheet" href="../lesson.css">
<script language="JavaScript" src="../pos_quiz/scripts/behActions.
js"></script>
<script language="JavaScript" src="../gl_quiz/scripts/behActions.
js"></script>
<script language="JavaScript" src="scripts/behActions.
js"></script>
</head>
<body bgcolor="#FFFFFF" onLoad="MM_initInteractions();MM_judgeInt('G01')" link="#0000CC" alink="#0000CC" background="../images/gl_lite.gif">
<div id="scoreL" style="position:absolute; left:187px; top:49px; width:324px; height:52px; z-index:1">
<table width="324" border="0" cellspacing="0" cellpadding="0" height="52">
<tr valign="top">
<td class="bullet1"><b></b></td>
</tr>
</table>
</div>
<div id="Layer1" style="position:absolute; left:16px; top:54px; width:117px; height:96px; z-index:11"><img src="../../Lessons/images/ap_icon2.gif" width="149" height="164"></div>
<div id="Layer2" style="position:absolute; left:189px; top:115px; width:324px; height:132px; z-index:12">
<table width="323" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td class="bullet1"><b><span class="bullet1"><span class="bullet1"><span class="bullet1"><span class="bullet1">If
you'd like to review any information on Accounts Payable, click the link
below, or make another selection from the menu on the left.</span></span></span></span></b>
<br>
<br>
<span class="bullet1"><span class="bullet3"><span class="bullet3"><b><a href="javascript
:openWindow('../../Lessons/ap_les/ap_index.htm');">Accounts
Payable Application Training</a></b></span></span></span></td>
</tr>
</table>
</div>
<div id="Layer1" style="position:absolute; left:186px; top:2px; width:374px; height:22px; z-index:36">
<table width="374" border="0" cellspacing="0" cellpadding="0" height="28">
<tr>
<td>
<div align="right"><b><i><span class="head1"><span class="head1"><span class="head1">Accounts
Payable Quiz</span></span></span></i></b> </div>
</td>
</tr>
</table>
</div>
<div id="Layer3" style="position:absolute; left:560px; top:2px; width:32px; height:25px; z-index:9"><img src="../../images/quiz2.gif" width="45" height="23"></div>
<div id="Layer4" style="position:absolute; left:518px; top:49px; width:85px; height:25px; z-index:37">
<table width="84" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="instr_big">
<div align="center"> <a href="javascript
:print()"><img width="77" height="56" border="0" src="../images/print.gif"></a></div>
</td>
</tr>
</table>
</div>
<p> </p>
<div id="Layer2" style="position:absolute; left:8px; top:22px; width:595px; height:16px; z-index:32">
</div>
<p> </p>
<interaction name="ActionMgr01" object="G01" template="080_Action Manager/010_ActionMgr_03.agt" includesrc="interactionClass.
js">
<div name="G01Layer">
<form name="G01controls">
</form>
</div>
<script language="JavaScript">
<!--
// Copyright 1998,1999 Macromedia, Inc. All rights reserved.
function newG01() {
G01 = new MM_interaction('G01',0,0,0,null,0,0,0,'','','','', 0);
G01.init();
G01.am('segm','Display status_',1,0);
G01.am('actn','Call JavaScript - custom var name','MM_callJS(\'quiz = parent.nav.quiz\')','');
G01.am('actn','Call JavaScript - totalScore','MM_callJS(\'totalScore = quiz[1].score + quiz[2].score + quiz[3].score + quiz[4].score + quiz[5].score + quiz[6].score + quiz[7].score + quiz

.score\')','');
G01.am('actn','Set Text of Layer','MM_setTextOfLayer(\'scoreL\',\'\',\'%3Cfon t face=%22Arial, Helvetica, sans-serif%22%3E%3Cb%3E%3Cfont color=%22#333333%22 size=%22+1%22 class=%22bullet1%22%3EYour %0D%0A score for the Accounts Payable quiz is \'+(totalScore)+\'%25.%3C/font%3E%3C/b%3E%3C/font%3E\')','');
}
if (window.newG01 == null) window.newG01 = newG01;
if (!window.MM_initIntFns) window.MM_initIntFns = ''; window.MM_initIntFns += 'newG01();';
//-->
</script>
<cbi-select object="G01"></interaction>
</body>
</html>
Here is the navigation frame code just in case you need it:
<html>
<head>
<title>nav</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
//-->
</script>
<script language="JavaScript">
<!--
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#ECECEC" text="#000000" link="#0000CC" vlink="#9999FF" alink="#CC0000" onLoad="MM_preloadImages('../../images/next_r2_c2_f2.gif')">
<div id="Layer2" style="position:absolute; left:575px; top:2px; width:42px; height:41px; z-index:2">
<table border="0" cellpadding="0" cellspacing="0" width="38">
<tr>
<td><img src="../../images/shim.gif" width="3" height="1" border="0"></td>
<td><img src="../../images/shim.gif" width="31" height="1" border="0"></td>
<td><img src="../../images/shim.gif" width="4" height="1" border="0"></td>
<td><img src="../../images/shim.gif" width="1" height="1" border="0"></td>
</tr>
<tr valign="top">
<td colspan="3"><img name="next_r1_c1" src="../../images/next_r1_c1.gif" width="38" height="1" border="0"></td>
<td><img src="../../images/shim.gif" width="1" height="1" border="0"></td>
</tr>
<tr valign="top">
<td rowspan="2"><img name="next_r2_c1" src="../../images/next_r2_c1.gif" width="3" height="39" border="0"></td>
<td><a href="javascript
:goNext()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('next_r2_c2','','../../images/next_r2_c2_f2.gif',1);" ><img name="next_r2_c2" src="../../images/next_r2_c2.gif" width="31" height="27" border="0"></a></td>
<td rowspan="2"><img name="next_r2_c3" src="../../images/next_r2_c3.gif" width="4" height="39" border="0"></td>
<td><img src="../../images/shim.gif" width="1" height="27" border="0"></td>
</tr>
<tr valign="top">
<td><img name="next_r3_c2" src="../../images/next_r3_c2.gif" width="31" height="12" border="0"></td>
<td><img src="../../images/shim.gif" width="1" height="12" border="0"></td>
</tr>
</table>
</div>
<script language="javascript">
<!--
// constructor for a quiz page object
function quizPage(src,time, timeLimit, tries, score, completed) {
this.src = src
this.time = (!time) ? 0 : time
this.timeLimit = (!timeLimit) ? 0 : timeLimit
this.tries = (!tries) ? 0 : tries
this.score = (!score) ? 0 : score
this.completed = (!completed) ? false : completed
}
// create array of all quiz pages in the entire quiz
var quiz = new Array()
quiz[0] = new quizPage("ap_home.htm")
quiz[1] = new quizPage("ap_q1.htm")
quiz[2] = new quizPage("ap_q2.htm")
quiz[3] = new quizPage("ap_q3.htm")
quiz[4] = new quizPage("ap_q4.htm")
quiz[5] = new quizPage("ap_q5.htm")
quiz[6] = new quizPage("ap_q6.htm")
quiz[7] = new quizPage("ap_q7.htm")
quiz

= new quizPage("ap_q8.htm")
quiz[9] = new quizPage("ap_sum.htm")
// 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
}
}
}
// 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(p[0], p[1], p[2], p[3], p[4], parseInt(p[5]),
parseInt(p[6]), parseInt(p[7]), parseInt(p

), p[9])
}
}
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 setScores(URL, score) {
var obj = findPage(URL)
obj.score = score
saveQuizObjects()
}
// reset tries and score property settings for a quiz object
function resetObject(URL) {
var obj = findPage(URL)
obj.tries = 0
var triesFld = KO_findObject("tries")
triesFld.value = obj.score
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>
<div align="right"> </div>
</body>
</html>
I have tried several things, such as G01.totalScore, G01.score, totalScore, score, newG01.totalScore and newG01.score. I am stumped. Please help in any way you can.
Thank you,
Clay
Clay Hess