[JavaScript] 在页面的状态栏动态显示时间 →→→→→进入此内容的聊天室

来自 , 2019-03-29, 写在 JavaScript, 查看 131 次.
URL http://www.code666.cn/view/72b32a1f
  1. <html>
  2. <head>
  3. <title>在页面的状态栏动态显示时间</title>
  4. </head>
  5. <body onLoad="showtime();" onUnload="clearTimeout(tID);">
  6. 在状态栏上显示了当前时间
  7. <script Language="JavaScript">
  8. var gtime;
  9. function showtime() {
  10.    var now = new Date();
  11.    var hours = now.getHours();         //取得当前小时、分、秒
  12.    var minutes = now.getMinutes();
  13.    var seconds = now.getSeconds();
  14.    var timeValue = "现在是"+((hours >= 12) ? "下午" : "上午" );
  15.    timeValue +=((hours >12) ? hours -12 :hours);
  16.    timeValue += "点 " + minutes + "分 " + seconds + "秒";
  17.    window.status = timeValue;
  18.    gtime = setTimeout("showtime()",1000);        //每1000毫秒更新一次
  19. }
  20. </script>
  21. </body>
  22. </html>
  23.  

回复 "在页面的状态栏动态显示时间"

这儿你可以回复上面这条便签

captcha