<script language="javascript">
function disptime(){
var today = new Date();
var year = today.getYear();
var month = today.getMonth();
var date = today.getDate();
var hh = today.getHours();
var mm = today.getMinutes();
var ss = today.getSeconds();
/*设置div的内容为当前时间*/
document.getElementById("myclock").innerHTML ="<h1>现在是: "+year+"年"+month+"月"+date+"日"+hh+":"+mm+":" +ss+ "</h1>";
}
setInterval("disptime()",1000);
</script>
<body>
<div id="myclock">
</div>
</body>
javascript实现动态时钟
最新推荐文章于 2022-06-09 19:13:14 发布