<html><head>
<script type="text/javascript">
function show()
{
var time=new Date();
var hour=time.getHours();
var minute=time.getMinutes();
var second=time.getSeconds();
document.write(hour+":"+minute+":"+second);
setTimeout("show()",1000);
}
</script>
</head><body>
<input type="button" value="点击开始时间" onClick="show()"/></body></html>我想让他一直动态显示时间 为什么不可以?
<script type="text/javascript">
function show()
{
var time=new Date();
var hour=time.getHours();
var minute=time.getMinutes();
var second=time.getSeconds();
document.getElementById("x").innerHTML=(hour+":"+minute+":"+second);
setTimeout("show()",1000);
}
</script>
</head><body>
<input type="button" value="点击开始时间" onClick="show()"/>
<div id=x></div>
</body></html>
setTimeout 不是在嘛??