home *** CD-ROM | disk | FTP | other *** search
/ Imagine the Universe (9th Edition) / Imagine the Universe 9 - Disc 1.iso / pc / imagine / docs / science / try_l1 / javascript / cosmic_rays.js < prev    next >
Encoding:
Text File  |  2002-01-09  |  831 b   |  35 lines

  1. size1 = "Blank";
  2. size2 = "Blank";
  3. size3 = "Blank";
  4.  
  5. function testButton(form) {
  6. size1 = document.elements.answer1.value - 0;
  7. if (!size1) {size1 = "Blank";}
  8. size2 = document.elements.answer2.value - 0;
  9. if (!size2) {size2 = "Blank";}
  10. size3 = document.elements.answer3.value - 0;
  11. if (!size3) {size3 = "Blank";}
  12.     
  13.     RightAnswer1 = 78;
  14.     RightAnswer2 = 120;
  15.     RightAnswer3 = 82;
  16.     
  17.     NumberCorrect = 0;
  18.     AnswerPage = 'cosmic_rays_solution.html';
  19.     
  20.     if (size1 == RightAnswer1) {
  21.         NumberCorrect++;
  22.     }
  23.     if (size2 == RightAnswer2) {
  24.         NumberCorrect++;
  25.     }
  26.     if (size3 == RightAnswer3) {
  27.         NumberCorrect++;
  28.     }
  29.     
  30.     alert ("You answered " +NumberCorrect + " out of the first 3 questions correctly!  Compare your answer to ours for the last one.");
  31.     location = AnswerPage; 
  32. }
  33.  
  34.     
  35.