时间倒计,若按右键时间不走了,利用这点可以作蔽
cnhfz 2004-11-09 11:42:22 这是一个简单测试代码:
当你按交卷按钮时上面的时间不走了,取消时又可以走了,这样有的学生就会利用这点进行作蔽.不知如何解决?
<script language="javascript">
var totalSecond,mkh,mname;
totalSecond=44;
totalMinutes=60;
var ss = setInterval(function()
{
str="<b><font size=3 color='#0000FF'>剩余时间:"+totalSecond+"分"+totalMinutes+"秒</font></b>";
sTime.innerHTML=str;
if (totalMinutes==0)
{
totalSecond--;
totalMinutes=60;
}
//若时间到
if (totalSecond<=-1)
{
form1.submit();
}
totalMinutes--;
},1000);
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<script>
function f_jj() //交卷
{
if (confirm("是否真的要退出?"))
{
}
}
</script>
<body>
<form method="POST" name="form1" action="" target="mainFrame">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><div id="sTime"></div>
</tr>
<tr>
<td align="center">
<input type="button" name="St1" value="交卷" onclick="f_jj()">
</td>
</tr>
</table>
</form>
</body>
</html>