id is hang_2
</div>
<script>
setInterval("document.getElementById('time1').innerHTML = new Date().toLocaleString()", 1000)
</script>
在右上角位置放上这个DIV
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta
http-equiv="Content-Type" content="text/htmlcharset=utf-8"
/>
<title>无标题文档</title>
<script
language="javascript">
var t = null
t =
setTimeout(time,1000)//开始执行
function time()
{
clearTimeout(t)//清除定时器
dt = new Date()
var
h=dt.getHours()
var m=dt.getMinutes()
var
s=dt.getSeconds()
document.getElementById("timeShow").innerHTML =
"现在的时间为:"+h+"时"+m+"分"+s+"秒"
t = setTimeout(time,1000)
//设定定时器,循环执行
}
</script>
</head>
<body>
<label
id="timeShow"></lable>
</body>
</html>
在<head></head>之间插入JAVASCRIPT代码<script language="JavaScript" type="text/javascript">
function showTime(){
var mytime=new Date()
var h=mytime.getHours()
var m=mytime.getMinutes()
var s=mytime.getSeconds()
if(h<10) h="0"+h
if(m<10) m="0"+m
if(s<10) s="0"+s
word.innerHTML=h+":"+m+":"+s
setTimeout("showTime()",1000)
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'")
if (restore) selObj.selectedIndex=0
}
function MM_findObj(n, d) { //v4.01
var p,i,x if(!d) d=documentif((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].documentn=n.substring(0,p)}
if(!(x=d[n])&&d.all) x=d.all[n]for (i=0!x&&i<d.forms.lengthi++) x=d.forms[i][n]
for(i=0!x&&d.layers&&i<d.layers.lengthi++) x=MM_findObj(n,d.layers[i].document)
if(!x &&d.getElementById) x=d.getElementById(n)return x
}
function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName)if (selObj) MM_jumpMenu(targ,selObj,restore)
}
</script>
然后在你想要显示的地方插入代码
<div class="STYLE3" id="word"></div>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)