倒计时问题
程序执行到函数djs只执行一次,是一个动态显示倒计时的js,请高手相帮,不胜感激。<body>
<span id="id1" style="display:none;">2009-10-01 00:00:00</span>
<script>
var dt = document.getElementById("id1").innerText;
var strArr = dt.split(" ");
var strDay = strArr[0].split("-");
var strTime = strArr[1].split(":");
//document.write(strDay[0]+strDay[1]+strDay[2]+strTime[0]+strTime[1]+strTime[2]);
//这个函数是倒计时
function djs()
{
minutes = 1000 * 60;
hours = minutes * 60;
days = hours * 24;
//var years = days * 365;
date1 = new Date();
date2 = new Date(Date.UTC(strDay[0], strDay[1]-1, strDay[2], strTime[0]-8, strTime[1], strTime[2]));
minudt = date2 - date1;
//var y = Math.floor(minudt/years);
d = Math.floor(minudt/days);
h = Math.floor((minudt - d * days)/hours);
m = Math.floor((minudt - d * days - h * hours)/minutes);
s = Math.floor((minudt - d * days - h * hours - m * minutes)/1000);
document.write(d + "天" + h + "时" + m + "分" + s + "秒");
setInterval("djs()",1000);
}
djs();
</script>
</body>