4-3.htm

来自「JScript网页特效,包含很多的实现网页特效的方法.」· HTM 代码 · 共 28 行

HTM
28
字号
<html>
<head>
<title>§4.3 在状态栏显示的时钟</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">

function showtime () {
  var now = new Date();
  var hours = now.getHours();
  var minutes = now.getMinutes();
  var seconds = now.getSeconds()
  var timeValue = " "
  timeValue += (hours >= 12) ? " 下午" : " 上午"
  timeValue += " " + ((hours >12) ? hours -12 :hours)
  timeValue += ((minutes < 10) ? ":0" : ":") + minutes
  timeValue += ((seconds < 10) ? ":0" : ":") + seconds
  window.status = timeValue;
  timerID = setTimeout("showtime()",1000);
}

</script>
</head>

<body bgcolor="#FFFFFF" onload="showtime()">
左下角就能看到时间了。 
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?