function clock(){
var time=new Date();
document.getElementById("clock").value = time;
}
var i=setInterval('clock()',1000);
var num=0;
function startCount() {
document.getElementById('count').value=num;
num=num+1;
setTimeout('startCount()',1000);
}
setTimeout('startCount()',1000);
用setTimeout('startCount()',1000);调用函数就可以,为什么直接写成startCount();调用就不行了? |