我想知道在网站里怎么样加入显示时间的代码

来源:百度知道 编辑:UC知道 时间:2024/09/22 05:39:30

color:#000000;TEXT-INDENT: 2em; line-height:23px;"><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&qu