日期:2014-05-16  浏览次数:20543 次

js实现在线测试8代码
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script language="javascript" type="text/javascript">
       
       function next(id1,id2){
        	document.getElementById("t"+id1).style.display = "none";
        	document.getElementById("t"+id2).style.display = "block";
       }
	   
	   function Result(form) {
		   document.getElementById("t10").style.display = "none";
        document.getElementById("t11").style.display = "block";
		var score = 0
		if (form.Q01[2].checked) { score ++; } //判断返回值
		if (form.Q02[1].checked) { score ++; }
		if (form.Q03[0].checked) { score ++; }


		if (form.Q04[2].checked) { score ++; }

		if (form.Q05[2].checked) { score ++; }
	
		if (form.Q06[2].checked) { score ++; }
	
		if (form.Q07[3].checked) { score ++; }
	
		if (form.Q08[0].checked) { score ++; }

		if (form.Q09[1].checked) { score ++; }
	
		if (form.Q10[0].checked) { score ++; }
	
		score1=score;                            //判断最终结果
		if (score1 > 8) { alert('恭喜恭喜!你答对了'+score1+'道题,成绩不错啊 ')}
		else { alert('你只答对了'+score1+'道题,继续努力!!!') }
		
		}
        
    </script>
</head>
<body>
<div  align="center">
  <h1>驾校考题测试</h1>
</div>
<FORM name=pt1>
<div  id="t0" align="center"style="border: 1px solid #84a1bd; margin: 10px 300px; font-size: 13px; padding: 10px;">
  <input type="button" name="" value="开始答题"  onClick="next(0,1)"/>
  <div > <br/>
    <br/>
  </div>
</div>
<div  id="t1" align="center"style="border: 1px solid #84a1bd; margin: 10px 300px; font-size: 13px; padding: 10px;display: none;">
  <object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=450 height=360 >
    <param name=ShowStatusBar value=-1>
    <param name=Filename value='c-32.wmv'>
    <embed src='c-32.wmv' width=430 height=360 align="middle" type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp></embed>
  </object>
  <div > <br/>
    <p>1.	这辆在道路上行驶的机动车有下列哪种违法行为?</p>
    <br/>
    <input name="Q01" type=radio value="">
    逆向行驶 
    <input name="Q01" type=radio value="">
    未按规定悬挂号牌
    <input name="Q01" type=radio value="">
    故意遮挡号牌
    <input name="Q01" type=radio value="">
    占用非机动车道<br/>
    <br/>
    <input type="button" name="" value="下一题"  onClick="next(1,2)"/>
  </div>
</div>
<div  id="t2" align="center"style="border: 1px solid #84a1bd; margin: 10px 300px; font-size: 13px; padding: 10px;display: none;">
  <object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=450 height=360 >
    <param name=ShowStatusBar value=-1>
    <param name=Filename value='c-46.wmv'>
    <embed src='c-46.wmv' width=430 height=360 align="middle" type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp></embed>
  </object>
  <div > <br/>
    <p>2.	前方路口这种信号灯表示什么意思?</p>
    <br/>
    <input name="Q02" type=radio value="">
    路口警示 
    <input name="Q02" type=radio value="">
    禁止通行
    <input name="Q02" type=radio value="">
    准许通行
    <input name="Q02" type=radio value=&qu