var date = new Date();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var mynum=date.getDay(1)
var timeStr = '';
timeStr = date.getFullYear() + "年" ;
timeStr += date.getMonth() + 1 +"月";
timeStr += date.getDate()+"日";
timeStr += weekday[mydate.getDay(1)];
document.write(timeStr);
为什么这样子显示不了星期一
var date = new Date();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var mynum=date.getDay(1)
var timeStr = '';
timeStr = date.getFullYear() + "年" ;
timeStr += date.getMonth() + 1 +"月";
timeStr += date.getDate()+"日";
timeStr += weekday[mynum];
document.write(timeStr);
这样子可以显示星期一了,为什么呢
另外我年月日没写就自动显示了,求解 |