代码参考:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document </TITLE>
<META http-equiv="Content-Type" content="text/htmlcharset=gb2312">
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="长风网络,SailSoft.Net">
</HEAD>
<BODY>
<script LANGUAGE="JavaScript">
<!-- Begin
day = new Date()
miVisit = day.getTime()
function clock() {
today = new Date()
hrNow = today.getHours()
mnNow = today.getMinutes()
scNow = today.getSeconds()
miNow = today.getTime()
if (hrNow == 0) {
hour = 12
ap = " AM"
} else if(hrNow <= 11) {
ap = " AM"
hour = hrNow
} else if(hrNow == 12) {
ap = " PM"
hour = 12
} else if (hrNow >= 13) {
hour = (hrNow - 12)
ap = " PM"
}
if (hrNow >= 13) {
hour = hrNow - 12
}
if (mnNow <= 9) {
min = "0" + mnNow
}
else (min = mnNow)
if (scNow <= 9) {
secs = "0" + scNow
} else {
secs = scNow
}
time = hour + ":" + min + ":" + secs + ap
document.form.button.value = time
self.status = time
setTimeout('clock()', 1000)
}
function timeInfo() {
milliSince = miNow
milliNow = miNow - miVisit
secsVisit = Math.round(milliNow / 1000)
minsVisit = Math.round((milliNow / 1000) / 60)
alert("你在本页面上大约停留了" + minsVisit + "分 "
+ secsVisit + "秒" )
}
document.write("<center><form name=\"form\">"
+ "<input type=button value=\"Click for info!\""
+ " name=button onClick=\"timeInfo()\"></form></center>")
onError = null
clock()
// End -->
</script>
</BODY>
</HTML>
很简单 用javascript 代码 获取当前时间 然后1调用一次<html>
<head>
<title>无标题文档</title>
</head>
<script type="text/javascript" language="javascript">
function shijian(){
var myDate = new Date()
var mytime=myDate.toLocaleTimeString()//获取当前时间
document.getElementById("av").innerHTML=mytime
}
setInterval('shijian()',1000)
</script>
<body >
<div id="av" style="width:100px"></div>
</body>
</html>
钟表的构造有表镜、表壳、表带、圈口、底盖、表盘、指针、表冠、表扣。钟表是一种计时的装置,也是计量和指示时间的精密仪器。钟表通常是以内机的大小来区别的。按国际惯例,机心直径超过80毫米、厚度超过30毫米的为钟;直径37~50毫米、厚度4~6毫米者,称为怀表;直径37毫米以下为手表;直径不大于20毫米或机心面积不大于314平方毫米的,称为女表。手表是人类所发明的最小、最坚固、最精密的机械之一。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)