Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quiz Total Score; quiz questions on multiple pages

Status
Not open for further replies.

terepan

Programmer
Oct 10, 2004
6
US
I am using the program Coursebuilder to display the quiz' total score for a quiz on multiple pages ( 8 questions: 8 pages)

Displaying the total score on the quiz summary page is not working for me. The problem is the JavaScript coding.

I am pasting in the JavaScript to the quiz summary page:
<script language=&quot;Javascript&quot;>
<!--
document.writeln(&quot;Your score is: &quot; + {[G01.score + G02.score + G03.score +
G04.score + G05.score + G06.score + G07.score + G02.score]/8} &quot; percent.&quot;)
//-->
</script>

The summary page where the script is posted is:

The GO1.score. GO2.score,... refer to the individual quiz page scores. Correct quiz
answers recieve one point, incorrect none.

The page that defines the variables is at:

The quiz starts at the page:

I would appreciate any help.

Teresa
 
try the following:

Your score is:
<script language=&quot;javascript&quot;>
var score = 0;
for (var i = 1; i < (quiz.length - 1); i++)
{
score += parseInt(getScore(i));
}
score /= 8;
document.writeln(score + &quot; percent&quot;);
</script>

There's no need to comment the javascript code - the pages won't work in older browsers anyway...
Sorry about the code being a little complicated ;-)

Hope this helps
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
hi,
i am actually not clear about what u r asking about..in any case, if you want the total score, summing up all the eight pages and display on the final page....well, as u know http is a stateless protocol..it does not maintain state of a webpage from one page to another..so whatever u r filling in a particular html page once u load another one, all the info in that particular html page is lost...so incase u want to carry over the information from page to page you have to set and retrieve cookies.....

well...does this mail makes any sense or am i going out of point???

Take care,
Regards,
R.Subramanian
 
What you're saying is perfectly correct - but the site consists of frames, and one of those frames is responsible for holding the variables that all pages of the quiz want to share.
My code should work, it took me some time (about half an hour) to grap the application structure... :) ...I'm relying on the variables and functions that are defined within the page.
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
hi,
oh if he is using frames means then itz o.k...but terepan do u really think that using frames in ur website makes it give a professional look??? Think twice on that.......instead u can use several external javascripts to create the same effect

Take care,
Regards,
R.Subramanian
 
This is actually for rsubras who replied. He has made some suggestions which I'm keen to follow up as I have a similar problem.
Quote
&quot;..so incase u want to carry over the information from page to page you have to set and retrieve cookies.....

&quot;Think twice on that.......instead u can use several external javascripts to create the same effect&quot;

Can subras please guide me?

Thank you very much

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top