状态栏本要实现倒计时,但显示错误(返回了非数值)
提交按钮不成功!
请帮忙改改,找到错误原因并用有色笔标记出来!谢谢!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
var card=new Array();
var usedcard=new Array();
for(i=0;i<4;i++)
{card[i]=0;
usedcar[i]=false;
}
var count=60;
var TimeId,StatusId;
function init(){
var i;
for(i=0;i<4;i++)
card[i]=Math.ceil(Math.random()*9);
StatusId=setTimeout("changestatus()",1000);
TimeId=setTimeout("open('timeout.html','towin','width=100,height=50');close();",60000);
}
function changestatus(){
clearTimeout(StatusId);
count--;
status="剩余时间为:"+count+"s";
setTimeout("changestatus()",1000);
}
function isvalid(){
var ex=document.setform.resulttext.value;
var exlen=ex.length;
var i,j;
var numerused=0;
for(i=0;i<exlen;i++)
{ var ch=ex.charAt(i);
if(eval(ch)>=0&&eval(ch)<=9)
{ for(j=0;j<4;j++)
if(eval(ch)==card[j]&&card[j]!=false)
{numerused++;
cardused[j]=false;
}
}
else
if(ch!="+"&&ch!="-"&&ch!="*"&&ch!="/"&&ch!="("&&ch!=")")
{alert("输入非法");return false;}
}
if(numused!=4)
{alert("你的输入是非法的!");
return false;}
return true;
}
function calresult(){
clearTimeout(TimeId);
if(isvalid()){
if(eval(document.setform.resulttext.value)==24)
{winid=open("yes.html","yeswind","width=100,height=50");
close();
return;
}
}
winid=open("no.html","nowind","width=100,height=50");
close();
return;
}
</script>
</head>
<body onLoad=document.setform.resulttext.focus()>
你可以使用的四张纸牌是:<br><br>
<script>
init();
for(i=0;i<4;i++)
document.write(card[i]+" ");
</script>
<p>
请在下边的输入框中输入你的答案:</p>
<form name="setform" >
<input type="text" name="resulttext" value="" size=20><br><br>
<input type="button" value="提交答案" onClick="calresult()">
<input type="button" value="放弃该局" onClick="self.close()">
</form>
</body>
</html>