<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
</head>
<body>
<form method="POST" name="form1">
<p> <input type="text" id="T1" answer="a" name="Txt" size="20"></p>
<div style="display:none" id=choose1>1. heightened 选举酝酿期间 气氛越来越紧张起来。</div>
<p> <input type="text" id="T2" name="Txt" answer="b" size="20"></p>
<div style="display:none" id=choose2>2. heightened 选举酝酿期间 气氛越来越紧张起来。</div>
<p> <input type="text" id="T3" name="Txt" answer="c" size="20"></p>
<div style="display:none" id=choose3>3. heightened 选举酝酿期间 气氛越来越紧张起来。</div>
<p>  </p>
<p align="center"><input type="button" value="提交答案" name="B3" onclick="checkkey()">&nbsp;&nbsp;&nbsp;&nbsp; <input type="button" onclick="resetinput()" value="全部重置" name="B2"></p>
</form>
<script language="javascript">
function checkkey()
{
var rightcount=0;
var errorcount=0;
var len=form1.Txt.length;
for(var i=0;i<len;i++)
if(form1.Txt[i].value==form1.Txt[i].answer)
rightcount += 1;
if(rightcount/len>0.6)
{
if(confirm("恭喜你,已答对超过60%\n\n确定是否查看答案?"))
{
with(form1){
choose1.style.display="";
choose2.style.display="";
choose3.style.display="";
}
}
}
else{
alert("只有答对超过60%才可看答案\n好好努力哦^_^")
}
}
function resetinput()
{
window.location.reload();}
</script>
</body>
</html>