<script type="text/javacript">
//实时显示系统时间
function ShowTime()
{
var timeString;
var intYear,intMonth,intDay,intHours,intMinutes,intSeconds;
var today;
today=new Date();
intYear=today.getYear();
intMonth=today.getMonth()+1;
intDay=today.getDate();
intHours=today.getHours();
intMinutes=today.getMinutes();
intSeconds=today.getSeconds();

if(intMonth<10)
{
   intMonth = "0" + intMonth;
}
if(intDay<10)
{
   intDay = "0" + intDay;
}
if(intHours<10)
{
   intHours = "0" + intHours;
}
if(intMinutes<10)
{
   intMinutes = "0" + intMinutes;
}
if(intSeconds<10)
{
   intSeconds = "0" + intSeconds;
}
timeString = String(intYear) + "-" + String(intMonth) + "-" + String(intDay) + "<br/>" + String(intHours) + ":" + String(intMinutes) + ":" + String(intSeconds);
document.getElementById("ShowTime").innerHTML = timeString;
window.setTimeout("ShowTime()",1000);
}
</script>

posted on 2012-05-20 18:21  知识天地  阅读(3435)  评论(0编辑  收藏  举报