年月日時分秒星期。如果按樓主要求,星期換下就可以,也就是
varndate=years+"年"+month+"月"+days+"日"+hours+":"+minutes+":"+seconds+""+week;
這句,換成
varndate=years+"年"+month+"月"+days+"日"+week+""+hours+":"+minutes+":"+seconds;
<html>
<head>
<title></title>
<scriptlanguage="javascript">
functiongetCurDate()
{
vard=newDate();
varweek;
switch(d.getDay()){
case1:week="星期一";break;
case2:week="星期二";break;
case3:week="星期三";break;
case4:week="星期四";break;
case5:week="星期五";break;
case6:week="星期六";break;
default:week="星期天";
}
varyears=d.getYear();
varmonth=add_zero(d.getMonth()+1);
vardays=add_zero(d.getDate());
varhours=add_zero(d.getHours());
varminutes=add_zero(d.getMinutes());
varseconds=add_zero(d.getSeconds());
varndate=years+"年"+month+"月"+days+"日"+hours+":"+minutes+":"+seconds+""+week;
divT.innerHTML=ndate;
}
functionadd_zero(temp)
{
if(temp<10)return"0"+temp;
elsereturntemp;
}
setInterval("getCurDate()",100);
</script>
</head>
<body>
<divid="divT"></div>
</body>
</html>