/* JavaScript本体 */ QuestionNumber=5; Question=new Array(QuestionNumber); Question[000]=new Array( '1+1=', '5,2,1,3', '1' ); Question[001]=new Array( '2+2=', '2,3,4,1', '2' ); Question[002]=new Array( '3+3=', '7,5,11,6', '3' ); Question[003]=new Array( '4+4=', '8,5,7,15', '0' ); Question[004]=new Array( '5+5=', '0,10,9,12', '1' ); for(A in Question) { Question[A][1]=Question[A][1].split(","); }; flag=0; Reset1(); function Q_A4_out() { if(flag1==1) { if(document.form2.radio1[Question[Qcount][2]].checked) { document.form2.text12.value="正解"; Point++; }else{ document.form2.text12.value="不正解 正解は"+Question[Qcount][1][(Question[Qcount][2])]; }; document.form2.radio1[Question[Qcount][2]].checked=false; Qcount++; document.form2.text10.value="現在の正答率"+Math.round((Point/Qcount)*100)+"% 残り"+(QuestionNumber-Qcount)+"問"; if(Qcount == QuestionNumber) { Reset1(); alert("end"); }; }else if(flag1==0){ flag1=1; document.form2.button1.value = "Next"; document.form2.text10.value=""; document.form2.text12.value=""; }; if(flag1==1) Q_A4_in(); }; function Q_A4_in() { document.form2.TextOut.value=Question[Qcount][0]; document.form2.text1.value=Question[Qcount][1][0]; document.form2.text2.value=Question[Qcount][1][1]; document.form2.text3.value=Question[Qcount][1][2]; document.form2.text4.value=Question[Qcount][1][3]; }; function Reset1() { Qcount=0; flag1=0; Point=0; for(i=0;i<100;i++) { Q1=Math.floor(Math.random() * (QuestionNumber-1)); Q2=Math.floor(Math.random() * (QuestionNumber-1)); BackUp=Question[Q1]; Question[Q1]=Question[Q2]; Question[Q2]=BackUp; }; document.form2.TextOut.value=""; document.form2.text1.value=""; document.form2.text2.value=""; document.form2.text3.value=""; document.form2.text4.value=""; document.form2.button1.value="Start"; }; /* HTML フォーム部*/