以下是我的一段程序,为什么时钟不能显示呢,请高手指点,谢谢
<html>
<head>
<title>时间问候</title>
<script language="javascript">
<!--
function disptime()
{
var now=new Date();
var year=now.getYear();
var month=now.getMonth();
var date=now.getDate();
var day=now.getDay();
var hour=now.getHours();
var minute=now.getMinutes();
var second=now.getSeconds();
document.write("今天是" +year+ "年" + month+ "月" +date+ "日"+" ");
switch(day)
{
case 0:
document.write("星期日");
break;
case 1:
document.write("星期一");
break;
case 2:
document.write("星期二");
break;
case 3:
document.write("星期三");
break;
case 4:
document.write("星期四");
break;
case 5:
document.write("星期五");
break;
case 6:
document.write("星期六");
break;
}
if(hour>=0 && hour<=12)
document.write(" 大家上午好!");
if(hour>12 && hour<=18)
document.write(" 大家下午好!");
if(hour>18 && hour<24)
document.write(" 大家晚上好!");
if(minute<10)
minute="0"+minute;
if(second<10)
second="0"+second;
document.myform.myclock.value=hour+":"+minute+":"+second;
var myTime=setTimeout("disptime()",1000);
}
-->
</script>
<style type="text/css">
<!--
input
{
font-size:15px;
color:red;
border-style:none
}
-->
</style>
</head>
<body onload="disptime()">
<br>
<br>
<form name="myform">
<input name="myclock" type="text" value="" size="15">
</form>
</body>
</html>