home *** CD-ROM | disk | FTP | other *** search
/ Correspondence Bible School - Life of Jesus Christ / _____.iso / Script / file.js < prev    next >
Text File  |  2003-11-05  |  2KB  |  109 lines

  1. function saveFile(txt)
  2. {
  3.     num = document.forms[0].lesson_num.value+'_'+document.forms[0].exam_num.value;
  4.     window.status='╧εµαδ≤Θ±≥α, ∩εΣεµΣΦ≥σ. ┬√∩εδφ σ≥±  ±ε⌡≡αφσφΦσ ≡στ≤δⁿ≥α≥εΓ ...';
  5.         try    {
  6.             var fso = new ActiveXObject("Scripting.FileSystemObject");
  7.             var fl = fso.CreateTextFile( "C:\\exam_"+num+".txt" , true);
  8.             fl.WriteLine(txt);
  9.             fl.Close(); delete fl; delete fso;
  10.         }    catch(e)    {}
  11.     window.status='';
  12. }
  13.  
  14. function openFile()
  15. {
  16.     num = document.forms[0].lesson_num.value+'_'+document.forms[0].exam_num.value;
  17.     s = "";
  18.     window.status='╧εµαδ≤Θ±≥α, ∩εΣεµΣΦ≥σ. ┬√∩εδφ σ≥±  ε≥Ω≡√≥Φσ ⌠αΘδα  ...';
  19.     try    {
  20.         var fso = new ActiveXObject("Scripting.FileSystemObject");
  21.         var fl = fso.OpenTextFile("C:\\exam_"+num+".txt");
  22.         var s = fl.ReadAll();
  23.         fl.Close(); delete fl; delete fso;
  24.     } catch(e){}
  25.     window.status='';
  26.     return s;
  27. }
  28.  
  29. function Qwest()
  30. {
  31.     var ch = '';
  32.     var the_form = document.forms[0];
  33.     try
  34.     {
  35.         for(j=1; j<21; j++)
  36.         {
  37.             var the_item;
  38.             eval("the_item=the_form.q" + j );
  39.             k = the_item.length;
  40.             if (k>0)
  41.             {
  42.                 //ch += j+"-";
  43.                 for(i=0;i<k;i++)
  44.                 {
  45.                     if(the_item[i].checked)
  46.                     {    
  47.                         ch += the_item[i].value;
  48.                     }
  49.                 }
  50.                 ch+=";";
  51.             }
  52.         }        
  53.     }catch(e){}    
  54.     return ch;
  55. }
  56.  
  57. function checkQwest()
  58. {
  59.     saveFile(Qwest());
  60. }
  61.  
  62. function resultQwest()
  63. {
  64.     document.forms.resform.result.value = Qwest()
  65. }
  66.  
  67.  
  68. function restoreQwest()
  69. {
  70.     var the_form = document.forms[0];
  71.     num = document.forms[0].lesson_num.value+'_'+document.forms[0].exam_num.value;
  72.     var the_item;
  73.     res = openFile();
  74.     try{
  75.  
  76.     if (res != '')
  77.     {
  78.         qw = res.split(";")
  79.         for(i=0;i<20;i++)
  80.         {
  81.             kk = i+1;
  82.             st = qw[i];
  83.             if(st !="")
  84.             {    
  85.                 eval("the_item=the_form.q" + kk);
  86.                 if(the_item[0].type == "checkbox")
  87.                 {
  88.                     ss = st.split("");
  89.                     for (ii = 0; ii < ss.length; ii++)
  90.                     {
  91.                         d = ss[ii];
  92.                         the_item[d].click();
  93.                         the_item[d].cheked = true;
  94.                     }
  95.  
  96.                 }
  97.                 else
  98.                 {
  99.                     the_item[st].cheked = true;
  100.                     the_item[st].click();
  101.                 }                
  102.             }
  103.         }
  104.     }
  105.     }catch(e){}
  106. }
  107.  
  108.  
  109.