<body onload="showTime()">
<input type=text value='' id=time>
<script>
function showTime()
{
var now = new Date();
document.all.time.value = now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
setTimeout("showTime()",1000);
}
</script>
<input type=text value='' id=time>
<script>
function showTime()
{
var now = new Date();
document.all.time.value = now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
setTimeout("showTime()",1000);
}
</script>
可以吗?
<p id=time></p>
<script>
function showTime()
{
var now = new Date();
document.all.time.innerText = now.getHours()+":"+now.getMinutes()+":"+now.getSeconds();
setTimeout("showTime()",1000);
}
</script>