日期:2014-05-16 浏览次数:20399 次
function tick()??
{??
var year,month,day,hours,minutes,seconds,ap;??
var intYear,intMonth,intDay,intHours,intMinutes,intSeconds;??
var today;??
today=new Date();??
intYear=today.getYear()+1900;??
intMonth=today.getMonth()+1;??
intDay=today.getDate();??
intHours=today.getHours();??
intMinutes=today.getMinutes();??
intSeconds=today.getSeconds();??
//获取系统时间的小时数??
if(intHours==0)??
{??
hours=intHours+":";??
ap="凌晨";??
}??
else if(intHours<12)??
{??
hours=intHours+":";??
ap="早晨";??
}??
else if(intHours==12)??
{??
hours=intHours+":";??
ap="中午";??
}??
else?
{??
intHours=intHours-12;??
hours=intHours+":";??
ap="下午";??
}??
//获取系统时间的分数??
if(intMinutes<10)??
{??
minutes="0"+intMinutes+":";??
}??
else?
{??
minutes=intMinutes+":";??
}??
//获取系统时间的秒数??
if(intSeconds<10)??
{??
seconds="0"+intSeconds+" ";??
}??
else?
{??
seconds=intSeconds+" ";??
}??
timeString=intYear+'年'+intMonth+'月'+intDay+'日'+hours+minutes+seconds+ap;??
document.getElementById("Clock").innerHTML=timeString;??
//每隔0.1秒钟执行一次tick函数??
window.setTimeout("tick()",100);??
}??
window.onload=tick;??
//document.getElementById("Clock").innerHTML=timeString;??
// --></mce:script>??
body中的div为:<div id="Clock"></div?