‹Æ¢è¿Žè®‰K—®æ—¥ç…§åŒÕd…»åŒ»é™¢ 今天æ˜?script type="text/javascript" language="javascript">
function show_cur_times(){
//获å–当å‰æ—¥æœŸ
var date_time = new Date();
//定义星期
var week;
//switch判æ–
switch (date_time.getDay()){
case 1: week="星期一"; break;
case 2: week="星期�; break;
case 3: week="星期�; break;
case 4: week="星期�; break;
case 5: week="星期�; break;
case 6: week="星期�; break;
default:week="星期�; break;
}
//òq?
var year = date_time.getFullYear();
//判斞®äºŽ10åQŒå‰é¢è¡¥0
if(year<10){ year="0"+year; }
//�
var month = date_time.getMonth()+1;
//判斞®äºŽ10åQŒå‰é¢è¡¥0
if(month<10){month="0"+month; }
//æ—?
var day = date_time.getDate();
//判斞®äºŽ10åQŒå‰é¢è¡¥0
if(day<10){ day="0"+day; }
//æ—?
var hours =date_time.getHours();
//判斞®äºŽ10åQŒå‰é¢è¡¥0
if(hours<10){ hours="0"+hours; }
//�
var minutes =date_time.getMinutes();
//判斞®äºŽ10åQŒå‰é¢è¡¥0
if(minutes<10){ minutes="0"+minutes; } //¿U?
var seconds=date_time.getSeconds();
//判斞®äºŽ10åQŒå‰é¢è¡¥0
if(seconds<10){ seconds="0"+seconds; }
//拼接òq´æœˆæ—¥æ—¶åˆ†ç§’ hours+":"+minutes+":"+seconds+" "+
var date_str = year+"òq?+month+"æœ?+day+"æ—?"+week;
//昄¡¤ºåœ¨id为showtimes的容器里
document.getElementById("showtimes").innerHTML= date_str;
}
//讄¡½®1¿U’调用一‹Æ¡show_cur_times函数
setInterval("show_cur_times()",100);