网络编程
位置:首页>> 网络编程>> JavaScript>> js实现动态显示时间效果

js实现动态显示时间效果

作者:1656767132  发布时间:2024-06-12 17:43:06 

标签:js,时间

话不多说,请看代码:


<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>时间显示器</title>  
</head>
<body>
   <div id="d"></div>
   <script type="text/javascript">
       var nowTime ;
       function play(){
       var time = new Date();
       nowTime = time.getFullYear()+"年"+time.getMonth()+"月"+time.getDate()+"日"+time.getHours()+"时"+time.getMinutes()+"分"+time.getSeconds()+"秒";
       document.getElementById("d").innerHTML = nowTime;
       }
       setInterval(play,1000);
   </script>    
</body>
</html>

来源:http://www.qdfuns.com/notes/42095/61bc6e53eb38450889112723df3a0210.html

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com