JS 完成时钟效果
<script>
function playTime(){
var today=new Date();
var hour=today.getHours();
var minute=today.getMinutes();
var second=today.getSeconds();
if(hour<10){
hour='0'+hour;
}
if(minute<10){
minute='0'+minute;
}
if(second<10){
second='0'+second;
}
document.getElementById('time').innerHTML="<p>时间:"+hour+":"+minute+":"+second+"</p>";
}
var myTime=setInterval("playTime()",1000);
</script>
<body>
<div id="time"></div>
</body>