标签存档: javascript - 第2页

显示时钟的JavaScript程序

<body>
<div id="ShowTime" align="left"></div>

<script>
showTime();
function showTime()
{
try
{
var date;
if (date==null)
{
date = new Date();
}
var unixtime = date.getTime();
document.getElementById("ShowTime").innerHTML=date.getYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
setTimeout("showTime()", 1000);
}
catch(e)
{}
}
</script>
</body>