사지 선다형 문제 풀이 응용 (ver. 1.5) > script

본문 바로가기

script

사지 선다형 문제 풀이 응용 (ver. 1.5)

작성일 07-08-08 16:04

페이지 정보

작성자서방님 조회 177회 댓글 0건

본문

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<title> 사지 단다형 문제풀이</title>

<meta name="Generator" content="EditPlus">

<script language="JavaScript1.1">

 

var msg1 = ""

var msg2 = ""

 

// 문제 해설과 답

var Solution = new Array(document.forms.length)

  Solution[0] = "5 + 1 = 6. <br> 정답 : 3번 "

  Solution[1] = "(3+2)/5 = 5/5 = 1 <br> 정답 : 2번"

  Solution[2] = "2 * 1 = 2 <br> 정답 : 2번"

  Solution[3] = "5 + 1 = 6. <br> 정답 : 3번 "

  Solution[4] = "(3+2)/5 = 5/5 = 1 <br> 정답 : 2번"

  Solution[5] = "2 * 1 = 2 <br> 정답 : 2번"

//

 

var dab = new Array('1','2','1','2','1','2') // 정답배열

 

function Panjung()

{

 

   var correct = 0 // 맞은 개수

   var Total = 0 // 응시문항수

   var wo = 0

   var pc = 0

   var pi = 0

   var Formsu = document.forms.length - 1// 문서내 폼 개수

 

   for(var i = 0; i < document.forms.length - 1 ; i++)

      {

         for(var j = 0 ; j < document.forms[i].elements.length; j++)

            {

               var chk = document.forms[i].elements[j]

               if(chk.checked)

                  {

                     var item = document.forms[i].elements[j].value

                     if(item == dab[i]) // 정답비교

                        {

                           correct++

                         }

                   Total++

                   }

              }

          if (i == 1) wo = correct // 과목별 맞은 개수 체크

          if (i == 3) pc = correct - wo

          if (i == 5) pi = correct - (pc + wo)

        }

 

 //  var jumsu = Math.round(correct/Formsu*30) // 점수계산

   if(Total == 0)

      {

         alert("문제를 풀지 않았습니다..!!!")

         history.go(-1)

       }

    else

       {

         var wrong = Formsu - correct

         ReportScore1(Formsu, correct, wrong, wo, pc, pi)

       }

}

 

function ReportScore1(Formsu, correct, wrong, wo, pc, pi)

{

  var gwo = Math.round(wo/2*10)

  var gpc = Math.round(pc/2*10)

  var gpi = Math.round(pi/2*10)

 

  var SecWin2 =

      window.open("","","scrollbars=no,width=300,height=420")

 

SecWin2.document.writeln('<html><head><script language="JavaScript1.1">')

SecWin2.document.writeln('function Graph()')

SecWin2.document.writeln('{')

SecWin2.document.writeln('var SecWin4 = window.open("","","scrollbars=no,width=500,height=200")')

SecWin2.document.writeln('var title = "<html><head><title>워드프로세서 성적 그래프</title></head><body bgcolor='+'LightYellow'+'>" +')

SecWin2.document.writeln('            "<p align='+'center'+'><font color='+'blue'+'><b>워드프로세서 성적 그래프</b></font></p>"')

 

SecWin2.document.writeln('var table = "<table border='+'1'+' cellpadding='+'0'+' cellspacing='+'0'+' width='+'425'+'" +')

SecWin2.document.writeln('    "bordercolordark='+'Darkcyan'+' bordercolorlight='+'Darkcyan'+' align='+'center'+'>" +')

SecWin2.document.writeln('    "<tr><td width='+'117'+' height='+'38'+'><p align='+'center'+'><B>워 드  용 어</B></p>" +')

SecWin2.document.writeln('    "</td><td width='+'231'+' height='+'38'+' style='+'text-indent:10;'+'>" + ')

 

SecWin2.document.writeln('    "<hr size='+'10'+' width='+(wo*5)+' align='+'left'+' noshade color='+'maroon'+'></td>" +')

SecWin2.document.writeln('    "<td width='+'69'+' height='+'38'+'><p align='+'center'+'><B>'+gwo+' 점</B></p></td></tr>" +')

SecWin2.document.writeln('    "<tr><td width='+'117'+' height='+'38'+'><p align='+'center'+'><B>PC운영체제</B></p></td>" +')

SecWin2.document.writeln('    "<td width='+'231'+' height='+'38'+' style='+'text-indent:10;'+'>" +')

 

SecWin2.document.writeln('    "<hr size='+'10'+' width='+(pc*5)+' align='+'left'+' noshade color='+'olive'+'></td>" + ')

SecWin2.document.writeln('    "<td width='+'69'+' height='+'38'+'><p align='+'center'+'><B>'+gpc+' 점</B></p>" +')

SecWin2.document.writeln('    "</td></tr><tr><td width='+'117'+' height='+'38'+'>" +')

SecWin2.document.writeln('    "<p align='+'center'+'><B>PC기본상식</B></p>" +')

SecWin2.document.writeln('    "</td><td width='+'231'+' height='+'38'+' style='+'text-indent:10;'+'>" +')

 

SecWin2.document.writeln('    "<hr size='+'10'+' width='+(pi*5)+' align='+'left'+' noshade color='+'red'+'></td>" + ')

SecWin2.document.writeln('    "<td width='+'69'+' height='+'38'+'><p align='+'center'+'><B>'+gpi+' 점</B></p>" + ')

SecWin2.document.writeln('    "</td></tr></table></body></html>"')

SecWin2.document.writeln('    SecWin4.document.write(title)')

SecWin2.document.writeln('    SecWin4.document.write(table)')

SecWin2.document.writeln('}')

SecWin2.document.writeln('<'+'/script></head><body bgcolor=Lightyellow>')

 

  var Pan1 = "<H2>평균점수 : "+ Math.round(correct/Formsu*30) + "점</H2><HR>"

  var Pan2 = Math.round(correct/Formsu*30)

 

  if (Pan2 >= 20)

     {

       msg2 =  Pan1 + "<H1 align='center' style='color:blue'>시험 합격</H1>" +

              "<MARQUEE direction=up behavior=alternate height=40><div align=center>" +

              "<font color=green><b>~~m^_^m~~</b></font></div></MARQUEE><br><BR>" +

              "<B>전체문항수 : " + (correct+wrong) + "</B><BR>" +

              "<B>맞 은 개 수 : " + correct + "</B><BR>" +

              "<B>틀 린 개 수 : " + wrong + "</B><BR><BR>" +

              "<B>워 드 용 어 : " + wo + " 개</B>    " + "<B>점수 = " + Math.round(pc/2*10) + "</B><BR>" +

              "<B>PC운영체제 : " + pc + " 개</B>    " + "<B>점수 = " + Math.round(pc/2*10) + "</B><BR>" +

              "<B>PC기본상식 : " + pi + " 개</B>    " + "<B>점수 = " + Math.round(pi/2*10) +"</B>"

 

      }

     else

     {

       msg2 =  Pan1 + "<H1 align=center style='color:red'>시험 불합격</H1><BR>" +

              "<MARQUEE direction=up behavior=alternate height=40><div align=center>" +

              "<font color=green><b>( ^_^ );</b></font></div></MARQUEE><br><BR>" +

              "<B>전체문항수 : " + (correct+wrong) + "</B><BR>" +

              "<B>맞 은 개 수 : " + correct + "</B><BR>" +

              "<B>틀 린 개 수 : " + wrong + "</B><BR><BR>" +

              "<B>워 드 용 어 : " + wo + " 개</B>    " + "<B>점수 = " + Math.round(wo/2*10) + "</B><BR>" +

              "<B>PC운영체제 : " + pc + " 개</B>    " + "<B>점수 = " + Math.round(pc/2*10) + "</B><BR>" +

              "<B>PC기본상식 : " + pi + " 개</B>    " + "<B>점수 = " + Math.round(pi/2*10)+ "</B>"

     }

 

  var pum ="<center><form>" + "<input type='button' name='Submit' value='성적 그래프' " +

           "Onclick='Graph()'>" + "</form></center></BODY></HTML>"

 

  SecWin2.document.writeln(msg2)

  SecWin2.document.writeln(pum)

  msg2 = ""  // Clear message

  pum = ""

}

 

function Grade()

{

   var correct = 0 // 맞은 개수

   var wrong = 0 // 틀린 개수

   var Total = 0 // 응시문항수

   var Formsu = document.forms.length - 1// 문서내 폼 개수

   for(var i = 0; i < document.forms.length - 1 ; i++)

      {

         for(var j = 0 ; j < document.forms[i].elements.length; j++)

            {

               var chk = document.forms[i].elements[j]

               if(chk.checked)

                  {

                     var item = document.forms[i].elements[j].value

                     if(item != dab[i]) // 정답비교

                        {

                           wrong++

                           msg1 += "<H4>문제 "+ (i+1) +".</H4>" + Solution[i] +"<BR>"

                         }

                     else

                        {

                           correct++

                        }

                   Total++

                   }

              }

        }

 

 //  var jumsu = Math.round(correct/Formsu*30) // 점수계산

   if(Total == 0 || Total != Formsu)

      {

         alert("문제를 다 풀지 않았습니다..!!!")

         msg1 = ""

  //     history.go(-1)

       }

    else

       {

         ReportScore2(correct, wrong)

       }

}

 

function ReportScore2(correct, wrong)

{

  var SecWin1 =

      window.open("","","scrollbars,width=400,height=300")

  var MustHave1 = "<HTML><HEAD><TITLE>당신의 틀린 문제</TITLE></HEAD><BODY bgcolor=Lightyellow>"

  var Percent = "<H2>맞은 개수 : "+ correct + "     " + "틀린개수 : " + wrong

                + "</H2><HR><br><b style='color:blue'>틀린문제의 정답과 해설</b>"

  msg1 = MustHave1 + Percent + msg1  + "</BODY></HTML>"

 

  SecWin1.document.write(msg1)

  msg1 = ""  // Clear message

}

 

function clr(){

    for (var i=0; i<document.forms.length; i++ ) {

        document.forms[i].reset()

    }

}

 

 

</script>

</head>

 

<BODY bgcolor="white" text="black" link="blue" vlink="purple" alink="red">

 

<H2 align="center">사지 선다형 문제 풀이 응용 (ver. 1.5)</H2>

<P><HR><BR></P>

<FORM method="get">

<P><b>워드프로세서 용어</b><BR><br>

<B>1.</B> X = 5 + 1<BR>

<INPUT type="radio" name=1 value="1">4<BR>

<INPUT type="radio" name=1 value="2">5<BR>

<BR> </P>

</FORM>

<FORM method="get">

<P><B>2.</B> X = (3 + 2) / 5 <BR>

<INPUT type="radio" name=2 value="1">0<BR>

<INPUT type="radio" name=2 value="2">1<BR>

<BR> </P>

</FORM>

 

<P><b>PC운영체제</b><BR>

<FORM method="get">

<P><B>3.</B> X = 2 * 1<BR>

<INPUT type="radio" name=3 value="1">1<BR>

<INPUT type="radio" name=3 value="2">2<BR>

<BR> </P>

</FORM>

<FORM method="get">

<B>4.</B> X = 5 + 1<BR>

<INPUT type="radio" name=4 value="1">4<BR>

<INPUT type="radio" name=4 value="2">5<BR>

<BR> </P>

</FORM>

 

<P><b>PC 기본상식</b><BR>

<FORM method="get">

<P><B>5.</B> X = (3 + 2) / 5 <BR>

<INPUT type="radio" name=5 value="1">0<BR>

<INPUT type="radio" name=5 value="2">1<BR>

<BR> </P>

</FORM>

<FORM method="get">

<P><B>6.</B> X = 2 * 1<BR>

<INPUT type="radio" name=6 value="1">2<BR>

<INPUT type="radio" name=6 value="2">3 <BR>

<BR> </P>

</FORM>

<FORM method="get">

<P><INPUT type="button" name="Submit" value="틀린문제" onclick="Grade()"> <input type="button" name="Submit" value="합격여부" onclick="Panjung()"> <input type="button" name="Submit" value="초기화" onclick="clr()"></p>

</FORM>

<P align="center"><FONT face="굴림" size="2">Copyright@2001 Seo, Jun O</FONT></P>

</body>

</HTML>

 

댓글목록

등록된 댓글이 없습니다.

게시물 검색
Copyright © 서방님.kr All rights reserved.
PC 버전으로 보기