<!DOCTYPE html>
<html>
<head>
<title>倒计时</title>
<script type="text/javascript">
function countDown(){
var a = document.getElementById('count');
a.value=a.value-1;
var b = setTimeout(countDown,1000);
//注意比较两种定时器的内在逻辑。
if(a.value<1){
clearTimeout(b);
return;
}
}
</script>
</head>
<body>
<form id="form1" name="form1">
<label>剩余时间(秒)</label>
<input type="text" name="count" id="count" value="100"/>
<br/>
<input type="button" name="Submit" value="开始倒计时" onclick="countDown()"/>
</form>
</body>
</html>
08-13
695

05-13
07-30
493
