网页学习体会

  • 首页
  • 个人博客
您的位置: 首页  >  IT文章  >  js:页面展示时钟

js:页面展示时钟

分类: IT文章 • 2022-06-07 12:53:10
js:页面显示时钟

<html>
<head>
<script type="text/javascript">
function startTime()
{
var today=new Date()
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
document.getElementById('txt').innerHTML=h+":"+m+":"+s
t=setTimeout('startTime()',500)
}

function checkTime(i)
{
if (i<10)
  {i="0" + i}
  return i
}
</script>
</head>

<body onload="startTime()">
<div id="txt"></div>
</body>
</html>

相关推荐

  • js 页面无滚动条添加滚轮事件
  • 解决 Page 'http://localhost:63342/v3/js/math/math.map' requested without authorization页面未授权问题 解决 Page 'http://localhost:63342/v3/js/math/math.map' requested without authorization页面未授权问题
  • JS 页面加载触发事件的区别
  • 使用JS计算Google Authenticator Code sjcl.js 计算Gcode JS HTML页面 网页效果
  • 屏幕的遮挡层,js得到屏幕宽高、页面宽高 (window.screen.availHeight)等--
  • JS判断页面是在浏览器还是微信打开
  • 前端开发---ppt展示页面评论区展示
  • 前端开发--ppt展示页面跳转逻辑实现
  • 前端开发---ppt展示页面评论区支持动态交互效果
  • js 页面滑动时禁止触发touchend事件
  • 基于XML配备方式实现对action的所有方法和指定方法进行输入校验
  • VB!去掉s1中的出现在s2中的字符,帮忙见见
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 网页学习体会    备案号:   粤ICP备20002247号