代碼:
<script language="JavaScript">
<!--
document.write('<div align="center"><font size="2">');
document.write("<span id='clock'></span>");
var now,year,month,date,hours,minutes,seconds,timeValue;
function showtime(){
now = new Date();
date = now.getDate();
month= now.getMonth() + 1;
year= now.getYear();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
timeValue = ((year > 2055) ? year + 1900 : year) + "年 ";
timeValue += ((month > 12) ? month - 12 : month) + "月 ";
timeValue += ((date > 31) ? date - 31 : date) + "日 ";
timeValue += ((hours > 12) ? hours - 12 : hours) + "點 ";
timeValue += ((minutes < 10) ? " 0" : " ") + minutes + "分 ";
timeValue += ((seconds < 10) ? " 0" : " ") + seconds + "秒 ";
timeValue += (hours >= 12) ? "下午 " : "上午 ";
clock.innerHTML = timeValue;
setTimeout("showtime()",100);
}
showtime();
document.write('</font></div>');
//-->
</script>
代碼在IE下是正常的
顯示後, 年份變成
105年下面代碼如果拿掉
> 2055 火狐就正常, 但IE變
3905年代碼:
timeValue = ((year > 2055) ? year + 1900 : year) + "年 ";
試問是哪個瀏覽器的錯誤