其他分享
首页 > 其他分享> > jQuery动态时钟

jQuery动态时钟

作者:互联网

效果图:

代码:

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <meta charset="utf-8" />
 5         <title></title>
 6         <script src="js/jQuery.js"></script>
 7     </head>
 8     <body>
 9         <p id="show"></p>
10         <script>
11             function setTime() {
12                     var date = new Date();
13                     var HH = date.getHours(),
14                         MM = date.getMinutes(),
15                         SS = date.getSeconds(),
16                         date = date.getDate();
17                         if(SS<10){
18                             SS = "0"+SS
19                         }
20                     $("#show").text(HH+":"+MM+":"+SS);
21                 }
22                 //设置时间间隔
23                 setInterval(setTime, 1000);
24         </script>
25     </body>
26 </html>

 

标签:jQuery,getSeconds,getMinutes,SS,var,date,动态,时钟
来源: https://www.cnblogs.com/ChenChaim/p/11747200.html