<body>
<script>
function tick() {
var ye,mo,da; //年月日
var hours, minutes, seconds, xfile; //时分秒,PM/AM
var intHours, intMinutes, intSeconds;
var today;
today = new Date();//创建一个时间对象
//ye = today.getFullYear();//获取完整的4位年份 ,跟下一句代码是一样的
ye=(today.getYear() < 1900) ? (1900 + today.getYear()) : today.getYear();
//Firefox和Chrome的getYear()返回的是“当前年份-1900”的值,而IE却当Year>=2000,直接把减去的1900又加回来了。
mo = today.getMonth()+1;//月份是从0开始,即0是1月
if (mo < 10) {
mo = "0"+mo;
}
da = today.getDate();//取出当前日期
if (da < 10) {
da = "0"+da;
}
intHours = today.getHours();//获取当前的小时数,存放在intHours里边
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours == 0) {
hours = "12:";
xfile = "AM";//午夜
} else if (intHours < 12) {
hours = intHours+":";
xfile = "AM";//上午
} else if (intHours ==