setTimeout怎么不能用?

来源:百度知道 编辑:UC知道 时间:2024/05/11 15:01:37
<html>
<head>
<title>
奥运会倒计时
</title>
<script language="javascript">
var now=new Date();
var stop=new Date("8/8/2008 20:08:08");
function minus()
{
var time=stop.getTime()-now.getTime();
var year=Math.floor(time/(365*24*3600*1000));
var month=Math.floor(time/(30*24*3600*1000)-year*12);
var date=Math.floor(time/(24*3600*1000)-year*365-month*30);
var hour=Math.floor(time/(3600*1000)-year*8760-month*720-date*24);
var minute=Math.floor(time/(60*1000)-year*525600-month*43200-date*1440-hour*60);
var second=Math.floor(time/(1000)-year*31536000-month*2592000-date*86400-hour*3600-minute*60);
document.n.t0.value=year;
document.n.t1.value=month;
document.n.t2.value=date;
document.n.t3.value=hour;
document.n.t4.value=minute;
document.n.t5.value=second;
setTimeout("minus()",1000);
}
</script>
</head>

window.setTimeout("minus()",1000);

老兄,你这个是高难度的,我用了几个小时时间也没弄出来。不过我可以告诉你,上面的时间代码得不到更新,我想应该用innerHTML来不时的刷新时间才行,但是由于知识有限,我没做出来