Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 136

# Passing a value across frames

Ok, gator4life has been a HUGE help to me, much thanks for that.  Now that I have my radio buttons validating, I need to pass the values of the fields.

The script I have calculates the number of "yes" answers on each page and puts them into 6 separate fields(a - f), according to how they are answered.  I need to keep track of how many "yes" answers there are across 9 pages of questions, and add them up at the end.

Here's the twist!

The questions are labeled from a to f.  Question 1 is a, 2 is b, 3 is c, 4 is d, 5 is e, 6 is f, 7 is a, 8 is b, etc.  I have my code calculating how many a "yes", how many b "yes", etc.

I need the a yesses in one field, b yesses in another field, etc.

How can I pass these values on, and add the new amount of "yesses" from each page into a frame?

I hope it's not too confusing!
0
ashleypower
• 5
• 3
1 Solution

Author Commented:
Sorry, I forgot the source code!  Here it is:

<HTML>

<TITLE>TEST</TITLE>

<SCRIPT language = JavaScript>

<!--

if (window.focus) self.focus();

var totals=[0,0,0,0,0,0];
var numquestions=18;

for(i=0;i<numquestions;i++)
if(eval("document.quiz.Q" + (i+1) + "[0].checked") )
totals[i%6]++;

for(i=0; i<6; i++)
eval("document.quiz." + String.fromCharCode(97+i) + ".value=totals[" + i + "];");

}

function check() {

var iNumQuestions = 18;

for (var i = 1; i <= iNumQuestions; i++) {

var bOneChecked = false;
var aRadios = document.getElementsByName('Q' + i);

for (var j = 0; j < aRadios.length; j++) {

}

if (!bOneChecked) return false;
}

return true;
}

//-->

</SCRIPT>

<BODY>

<FORM NAME = "quiz">

<TABLE CELLSPACING = "10">

<TR>
<TD>1(A). One</TD>
<TD><INPUT TYPE = "radio"  NAME="Q1" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q1" VALUE = "no">No</TD>
</TR>

<TR>
<TD>2(B). Two</TD>
<TD><INPUT TYPE = "radio"  NAME="Q2" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q2" VALUE = "no">No</TD>
</TR>

<TR>
<TD>3(C). Three</TD>
<TD><INPUT TYPE = "radio"  NAME="Q3" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q3" VALUE = "no">No</TD>
</TR>

<TR>
<TD>4(D). Four</TD>
<TD><INPUT TYPE = "radio"  NAME="Q4" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q4" VALUE = "no">No</TD>
</TR>

<TR>
<TD>5(E). Five</TD>
<TD><INPUT TYPE = "radio"  NAME="Q5" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q5" VALUE = "no">No</TD>
</TR>

<TR>
<TD>6(F). Six</TD>
<TD><INPUT TYPE = "radio"  NAME="Q6" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q6" VALUE = "no">No</TD>
</TR>

<TR>
<TD>7(A). Seven</TD>
<TD><INPUT TYPE = "radio"  NAME="Q7" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q7" VALUE = "no">No</TD>
</TR>

<TR>
<TD>8(B). Eight</TD>
<TD><INPUT TYPE = "radio"  NAME="Q8" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q8" VALUE = "no">No</TD>
</TR>

<TR>
<TD>9(C). Nine</TD>
<TD><INPUT TYPE = "radio"  NAME="Q9" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q9" VALUE = "no">No</TD>
</TR>

<TR>
<TD>10(D). Ten</TD>
<TD><INPUT TYPE = "radio"  NAME="Q10" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q10" VALUE = "no">No</TD>
</TR>

<TR>
<TD>11(E). Eleven</TD>
<TD><INPUT TYPE = "radio"  NAME="Q11" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q11" VALUE = "no">No</TD>
</TR>

<TR>
<TD>12(F). Twelve</TD>
<TD><INPUT TYPE = "radio"  NAME="Q12" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q12" VALUE = "no">No</TD>
</TR>

<TR>
<TD>13(A). Thirteen</TD>
<TD><INPUT TYPE = "radio"  NAME="Q13" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q13" VALUE = "no">No</TD>
</TR>

<TR>
<TD>14(B). Fourteen</TD>
<TD><INPUT TYPE = "radio"  NAME="Q14" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q14" VALUE = "no">No</TD>
</TR>

<TR>
<TD>15(C). Fifteen</TD>
<TD><INPUT TYPE = "radio"  NAME="Q15" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q15" VALUE = "no">No</TD>
</TR>

<TR>
<TD>16(D). Sixteen</TD>
<TD><INPUT TYPE = "radio"  NAME="Q16" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q16" VALUE = "no">No</TD>
</TR>

<TR>
<TD>17(E). Seventeen</TD>
<TD><INPUT TYPE = "radio"  NAME="Q17" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q17" VALUE = "no">No</TD>
</TR>

<TR>
<TD>18(F). Eighteen</TD>
<TD><INPUT TYPE = "radio"  NAME="Q18" VALUE = "yes">Yes
<INPUT TYPE = "radio" NAME="Q18" VALUE = "no">No</TD>
</TR>

</TABLE>

<INPUT TYPE = reset VALUE = "Clear"></B>

<P>

Sum of YES A = <INPUT SIZE = "3" NAME = "a" VALUE=0>
<P>
Sum of YES B = <INPUT SIZE = "3" NAME = "b" VALUE=0>
<P>
Sum of YES C = <INPUT SIZE = "3" NAME = "c" VALUE=0>
<P>
Sum of YES D = <INPUT SIZE = "3" NAME = "d" VALUE=0>
<P>
Sum of YES E = <INPUT SIZE = "3" NAME = "e" VALUE=0>
<P>
Sum of YES F = <INPUT SIZE = "3" NAME = "f" VALUE=0>
</FORM>

</BODY>

</HTML>
0

Commented:
hi
function setsrc(){
for(i=0;i<totals.length;i++)
lasttotals[i]=parseInt(lasttotals[i])+parseInt(totals[i]);
}
in each page to point to the next

this script could be made to update the sum boxes by
adding "cal();" to the end off
getsrc()
cleartotals()

here is the code
=========================================================
<HTML>

<TITLE>TEST</TITLE>

<SCRIPT language = JavaScript>

<!--

if (window.focus) self.focus();

var totals=[0,0,0,0,0,0];
var lasttotals =[0,0,0,0,0,0];

function cleartotals(){
for(i=0;i<totals.length;i++)
totals[i]=0;
}

function cal() {
for(i=0; i<6; i++)
eval("document.quiz." + String.fromCharCode(97+i) + ".value=totals[" + i + "]+parseInt(lasttotals["+i+"]);");

}
var pint = inx.replace("Q","");
var t = (pint-1)%6;

if(eval("document.forms[\"quiz\"].elements[\"Q"+pint+"\"][0].checked") )
totals[t]++;
else
if(totals[t]>=1)totals[t]--;

function check() {

var iNumQuestions = 18;

for (var i = 1; i <= iNumQuestions; i++) {

var bOneChecked = false;
var aRadios = document.getElementsByName('Q' + i);

for (var j = 0; j < aRadios.length; j++) {

}

if (!bOneChecked) return false;
}

return true;
}

function getsrc(){

if(location.search != ""){
var stri = location.search.substring(1,location.search.length)
lasttotals=stri.split('x');
}

}
function setsrc(){
for(i=0;i<totals.length;i++)
lasttotals[i]=parseInt(lasttotals[i])+parseInt(totals[i]);
}

//-->

</SCRIPT>

<FORM NAME = "quiz">

<TABLE CELLSPACING = "10">

<TR>
<TD>1(A). One</TD>
</TR>

<TR>
<TD>2(B). Two</TD>
</TR>

<TR>
<TD>3(C). Three</TD>
</TR>

<TR>
<TD>4(D). Four</TD>
</TR>

<TR>
<TD>5(E). Five</TD>
</TR>

<TR>
<TD>6(F). Six</TD>
</TR>

<TR>
<TD>7(A). Seven</TD>
</TR>

<TR>
<TD>8(B). Eight</TD>
</TR>

<TR>
<TD>9(C). Nine</TD>
</TR>

<TR>
<TD>10(D). Ten</TD>
</TR>

<TR>
<TD>11(E). Eleven</TD>
</TR>

<TR>
<TD>12(F). Twelve</TD>
</TR>

<TR>
<TD>13(A). Thirteen</TD>
</TR>

<TR>
<TD>14(B). Fourteen</TD>
</TR>

<TR>
<TD>15(C). Fifteen</TD>
</TR>

<TR>
<TD>16(D). Sixteen</TD>
</TR>

<TR>
<TD>17(E). Seventeen</TD>
</TR>

<TR>
<TD>18(F). Eighteen</TD>
</TR>

</TABLE>

<INPUT TYPE = "button" VALUE = "Calculate" onClick="JavaScript: if (!check()) alert('Not all answered!'); else cal();">
<INPUT TYPE = reset VALUE = "Clear" onclick="cleartotals()"></B>

<P>

Sum of YES A = <INPUT SIZE = "3" NAME = "a" VALUE=0>
<P>
Sum of YES B = <INPUT SIZE = "3" NAME = "b" VALUE=0>
<P>
Sum of YES C = <INPUT SIZE = "3" NAME = "c" VALUE=0>
<P>
Sum of YES D = <INPUT SIZE = "3" NAME = "d" VALUE=0>
<P>
Sum of YES E = <INPUT SIZE = "3" NAME = "e" VALUE=0>
<P>
Sum of YES F = <INPUT SIZE = "3" NAME = "f" VALUE=0>

</FORM>
<br><a href="#" onclick="JavaScript: if (!check()) alert('Not all answered!'); else setsrc();return false">next page</a>
</BODY>

</HTML>
0

Author Commented:
Error on line 78 aparently!  It doesn't work.  Thanks for your help tho.  Is there any way that I can do what i'm asking without changing the existing code I have?  Maybe add more to my existing "add" function?
0

Commented:
hi
the error is in line 33
I cut and pasted the function names to point out which functions
you need to add cal() to make the values update in real time
and should have removed them

remove these, but leave the '}' in place on line 33

having a look at the rest of question now
0

Author Commented:
This is what I have now:

<HTML>

<TITLE>TEST</TITLE>

<SCRIPT language = JavaScript>

<!--

if (window.focus) self.focus();

var totals=[0,0,0,0,0,0];
var lasttotals =[0,0,0,0,0,0];

function cleartotals(){
for(i=0;i<totals.length;i++)
totals[i]=0;
}

function cal() {
for(i=0; i<6; i++)
eval("document.quiz." + String.fromCharCode(97+i) + ".value=totals[" + i + "]+parseInt(lasttotals["+i+"]);");

}
var pint = inx.replace("Q","");
var t = (pint-1)%6;

if(eval("document.forms[\"quiz\"].elements[\"Q"+pint+"\"][0].checked") )
totals[t]++;
else
if(totals[t]>=1)totals[t]--;
}

function check() {

var iNumQuestions = 18;

for (var i = 1; i <= iNumQuestions; i++) {

var bOneChecked = false;
var aRadios = document.getElementsByName('Q' + i);

for (var j = 0; j < aRadios.length; j++) {

}

if (!bOneChecked) return false;
}

return true;
}

function getsrc(){

if(location.search != ""){
var stri = location.search.substring(1,location.search.length)
lasttotals=stri.split('x');
}

}
function setsrc(){
for(i=0;i<totals.length;i++)
lasttotals[i]=parseInt(lasttotals[i])+parseInt(totals[i]);
location = 'test2.htm?'+lasttotals.join('x');
}

//-->

</SCRIPT>

<FORM NAME = "quiz">

<TABLE CELLSPACING = "10">

<TR>
<TD>1(A). One</TD>
</TR>

<TR>
<TD>2(B). Two</TD>
</TR>

<TR>
<TD>3(C). Three</TD>
</TR>

<TR>
<TD>4(D). Four</TD>
</TR>

<TR>
<TD>5(E). Five</TD>
</TR>

<TR>
<TD>6(F). Six</TD>
</TR>

<TR>
<TD>7(A). Seven</TD>
</TR>

<TR>
<TD>8(B). Eight</TD>
</TR>

<TR>
<TD>9(C). Nine</TD>
</TR>

<TR>
<TD>10(D). Ten</TD>
</TR>

<TR>
<TD>11(E). Eleven</TD>
</TR>

<TR>
<TD>12(F). Twelve</TD>
</TR>

<TR>
<TD>13(A). Thirteen</TD>
</TR>

<TR>
<TD>14(B). Fourteen</TD>
</TR>

<TR>
<TD>15(C). Fifteen</TD>
</TR>

<TR>
<TD>16(D). Sixteen</TD>
</TR>

<TR>
<TD>17(E). Seventeen</TD>
</TR>

<TR>
<TD>18(F). Eighteen</TD>
</TR>

</TABLE>

<INPUT TYPE = "button" VALUE = "Calculate" onClick="JavaScript: if (!check()) alert('Not all answered!'); else cal();">
<INPUT TYPE = reset VALUE = "Clear" onclick="cleartotals()"></B>

<P>

Sum of YES A = <INPUT SIZE = "3" NAME = "a" VALUE=0>
<P>
Sum of YES B = <INPUT SIZE = "3" NAME = "b" VALUE=0>
<P>
Sum of YES C = <INPUT SIZE = "3" NAME = "c" VALUE=0>
<P>
Sum of YES D = <INPUT SIZE = "3" NAME = "d" VALUE=0>
<P>
Sum of YES E = <INPUT SIZE = "3" NAME = "e" VALUE=0>
<P>
Sum of YES F = <INPUT SIZE = "3" NAME = "f" VALUE=0>

</FORM>
<br><a href="test2.htm" onclick="JavaScript: if (!check()) alert('Not all answered!'); else setsrc();return false">next page</a>
</BODY>

</HTML>

file:///C:/WINDOWS/Desktop/test2.htm?3x3x3x3x3x3

but the values do not go into the fields.  Am I doing something wrong.  Please keep in mind that I really dont know what i'm doing!  Haha.  Thanks for your patience guys.
0

Author Commented:
Ok, with a bit of messing around, I got it working, but it passes the value to a frame.

Now the only problem that I have is that when I move on to the next page, I want the values ADDED on to the current values in the frame fields.  Now, it REPLACES them.

Here's what i've got:
===========================================
FRAMESET:

<HTML>

<SCRIPT LANGUAGE = "JavaScript">

function passa(str) {

top.frames['values'].document.values.a.value = str;

}

function passb(str) {

top.frames['values'].document.values.b.value = str;

}

function passc(str) {

top.frames['values'].document.values.c.value = str;

}

function passd(str) {

top.frames['values'].document.values.d.value = str;

}

function passe(str) {

top.frames['values'].document.values.e.value = str;

}

function passf(str) {

top.frames['values'].document.values.f.value = str;

}

</SCRIPT>

<FRAMESET COLS = "400,*">
<FRAME NAME = "quest" SRC = "test.htm">
<FRAME NAME = "values" SRC = "value.htm">
</FRAMESET>

</FORM>
</BODY>
</HTML>
=====================
QUESTIONS
=====================
<HTML>

<TITLE>AAA Test Page 1</TITLE>

<STYLE>

TABLE {font-family: arial; font-size: 12px; font-weight: bold}

</STYLE>

<SCRIPT language = JavaScript>

<!--

if (window.focus) self.focus();

var totals=[0,0,0,0,0,0];
var numquestions=24;

for(i=0;i<numquestions;i++)
if(eval("document.quiz.Q" + (i+1) + "[0].checked") )
totals[i%6]++;

for(i=0; i<6; i++)
eval("document.quiz." + String.fromCharCode(97+i) + ".value=totals[" + i + "];");
}

function check() {

var iNumQuestions = 18;

for (var i = 1; i <= iNumQuestions; i++) {

var bOneChecked = false;
var aRadios = document.getElementsByName('Q' + i);

for (var j = 0; j < aRadios.length; j++) {

}

if (!bOneChecked) return false;
}

return true;
}

//-->

</SCRIPT>

<BODY BGCOLOR = "#000099" TEXT = "#F8DE07">

<FORM NAME = "quiz">

<TABLE CELLPADDING = "4" CELLSPACING = "0" BORDER = "0">

<TR BGCOLOR = "#333399">
<TD>1(A). Fix a flat tire:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q1" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q1" VALUE = "no">No</TD>
</TR>

<TR>
<TD>2(B). Understand how carbon dating works:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q2" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q2" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>3(C). Play a musical instrument:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q3" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q3" VALUE = "no">No</TD>
</TR>

<TR>
<TD>4(D). Help people who need advice:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q4" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q4" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>5(E). Be a good salesperson:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q5" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q5" VALUE = "no">No</TD>
</TR>

<TR>
<TD>6(F). Operate a photocopier:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q6" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q6" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>7(A). Operate power tools such as a drill or sewing machine:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q7" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q7" VALUE = "no">No</TD>
</TR>

<TR>
<TD>8(B). Describe the function of the white blood cells:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q8" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q8" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>9(C). Participate in a church choir:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q9" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q9" VALUE = "no">No</TD>
</TR>

<TR>
<TD>10(D). Teach children how to tie shoelaces:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q10" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q10" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>11(E). Create a plan to achieve a goal:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q11" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q11" VALUE = "no">No</TD>
</TR>

<TR>
<TD>12(F). Filing paperwork:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q12" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q12" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD><INPUT TYPE = "radio"  NAME="Q13" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q13" VALUE = "no">No</TD>
</TR>

<TR>
<TD>14(B). Write a scientific or scholarly report:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q14" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q14" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>15(C). Express yourself through a painting or sculpture:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q15" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q15" VALUE = "no">No</TD>
</TR>

<TR>
<TD>16(D). Work well with others:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q16" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q16" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD><INPUT TYPE = "radio"  NAME="Q17" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q17" VALUE = "no">No</TD>
</TR>

<TR>
<TD>18(F). Do alot of paperwork in a short time:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q18" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q18" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>19(A). Make simple electrical repairs:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q19" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q19" VALUE = "no">No</TD>
</TR>

<TR>
<TD>20(B). Understand the formula in a simple chemistry equation:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q20" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q20" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD><INPUT TYPE = "radio"  NAME="Q21" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q21" VALUE = "no">No</TD>
</TR>

<TR>
<TD>22(D). Understand people's actions:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q22" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q22" VALUE = "no">No</TD>
</TR>

<TR BGCOLOR = "#333399">
<TD>23(E). Be confortable speaking to crowds:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q23" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q23" VALUE = "no">No</TD>
</TR>

<TR>
<TD>24(F). Keep accurate records of payments or sales:</TD>
<TD><INPUT TYPE = "radio"  NAME="Q24" VALUE = "yes" checked>Yes
<INPUT TYPE = "radio" NAME="Q24" VALUE = "no">No</TD>
</TR>

</TABLE>

parent.passa(document.quiz.a.value);
parent.passb(document.quiz.b.value);
parent.passc(document.quiz.c.value);
parent.passd(document.quiz.d.value);
parent.passe(document.quiz.e.value);
parent.passf(document.quiz.f.value);">

<INPUT TYPE = "hidden" SIZE = "3" NAME = "a" VALUE = 0>
<INPUT TYPE = "hidden" SIZE = "3" NAME = "b" VALUE = 0>
<INPUT TYPE = "hidden" SIZE = "3" NAME = "c" VALUE = 0>
<INPUT TYPE = "hidden" SIZE = "3" NAME = "d" VALUE = 0>
<INPUT TYPE = "hidden" SIZE = "3" NAME = "e" VALUE = 0>
<INPUT TYPE = "hidden" SIZE = "3" NAME = "f" VALUE = 0>
</FORM>

<A HREF = "test2.htm"> NEXT </A>

</BODY>

</HTML>
=======================
FRAME THAT HOLDS VALUES
=======================
<HTML>
<BODY>

<FORM NAME = "values">

<INPUT TYPE = "text" SIZE = "3" NAME = "a" VALUE = 0>
<INPUT TYPE = "text" SIZE = "3" NAME = "b" VALUE = 0>
<INPUT TYPE = "text" SIZE = "3" NAME = "c" VALUE = 0>
<INPUT TYPE = "text" SIZE = "3" NAME = "d" VALUE = 0>
<INPUT TYPE = "text" SIZE = "3" NAME = "e" VALUE = 0>
<INPUT TYPE = "text" SIZE = "3" NAME = "f" VALUE = 0>
<INPUT TYPE = reset VALUE = "Clear">

</FORM>

</BODY>

</HTML>
==========================

0

Commented:
hi
I had to make some changes to were the script is in the frameset
1 removed script from test.htm and placed in frameset head
so the values are always there.
2 changed how the script is called, these 5 lines are the end of page test.html, remove everything from <INPUT TYPE = "button" VALUE = "Calculate" down
and offcourse remoe the script from head of test.htm
just leave the if (window.focus) self.focus();

</FORM>
<A HREF = "#" onclick="top.nextpage('test2.htm');return true"> NEXT </A>
</BODY>
</HTML>

==========================================================
==========================================================

and this is index.htm

<HTML>

<SCRIPT language = JavaScript>

<!--

var totals=[0,0,0,0,0,0];
var pagetotals =[0,0,0,0,0,0];

cleartotals();
var numquestions=24;

for(i=0;i<numquestions;i++)
if(eval("top.frames[0].document.quiz.Q" + (i+1) + "[0].checked") )
pagetotals[i%6]++;

display();
}

function check() {

var iNumQuestions = 18;

for (var i = 1; i <= iNumQuestions; i++) {

var bOneChecked = false;
var aRadios = top.frames[0].document.getElementsByName('Q' + i);

for (var j = 0; j < aRadios.length; j++) {

}

if (!bOneChecked) return false;
}

return true;
}

var iput = ['a','b','c','d','e','f'];

function display(){
for(i=0; i<6; i++)
eval("top.frames['values'].document.values."+iput[i]+".value = "+(totals[i]+pagetotals[i])+";");
}
function cleartotals(){
for(i=0;i<pagetotals.length;i++)
pagetotals[i]=0;
}

function nextpage(page){
for(i=0;i<pagetotals.length;i++)
totals[i] += pagetotals[i];

top.frames[0].location.replace(page);
}
//-->

</SCRIPT>
<FRAMESET COLS = "400,*">
<FRAME NAME = "quest" SRC = "test.htm">
<FRAME NAME = "values" SRC = "value.htm">
</FRAMESET>

</FORM>
</BODY>
</HTML>
========================================================

hope you see the need to put script in index.html
when you are doing your testxxx pages place the url in the call to nextpage('test2.htm')

jonnal
0

Author Commented:
I figured it out on my own, but I appreciate the help!
0

## Featured Post

• 5
• 3
Tackle projects and never again get stuck behind a technical roadblock.