虹桥机场飞机维修招聘:asp显示时间的问题

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 00:55:41
做一个网页,显示时间,但时间是不停变化的.并且把日期.时.分.秒都显示出来
如:现在是2005年11月22号.9:15:30
到9:15:31秒时,在同一位置出现
现在是2005年11月22号.9:15:31
上面的那个30秒的时间当然没有了咯
问题补充:写出完整的代码咯,我看不懂呢

<html><head><title>网页显示时间<title>
<style><!--
.fo{boder:0};
-->
</style>
<script language="javascript">
<!--
function tim(){
var n=new Date();
year=n.getYear()+"年";
month=(n.getMonth()+1)+"月";
day=n.getDate()+"日";
hour=n.getHours();
min=n.getMinutes();
sec=n.getSeconds();
if(hour<10){hour="0"+hour;}
if(min<10){min="0"+min;}
if(sec<10){sec="0"+sec;}
mm=year+month+day+" "+hour+":"+min+":"+sec
document.form1.t1.value=mm;
setInterval("tim()",100);
}
-->
</script>
</head>
<body onload="tim();">
<form name="t1">
<input type="text" size="20" class="fo" name="t1">
</form>
</body>