<html>
<head>
<title>JavaScript實現頁面實時顯示當前時間</title>
</head>
<body>
<script language="javascript">
function showtime()
{
var today
var strDate ;
today=new Date();
var n_day = today
switch (n_day)
{
case
strDate = "星期日"
}break;
case
strDate = "星期一"
}break;
case
strDate ="星期二"
}break;
case
strDate = "星期三"
}break;
case
strDate = "星期四"
}break;
case
strDate = "星期五"
}break;
case
strDate = "星期六"
}break;
case
strDate = "星期日"
}break;
}
year = today
month = today
date = today
hour = today
minute =today
second = today
if(month<
if(date<
if(hour<
if(minute<
if(second<
document
setTimeout("showtime();"
}
</script>
<div id="time"></div>
<script language="javascript"> showtime();</script>
</body>
</html>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20508.html