慕粉3875660
2016-08-29 16:42
var mydate=new Date();
var weekdays=["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
document.write(mydate.getFullYear());
document.write(mydate.getMonth());
document.write(mydate.getDate());
document.write(weekdays[mydate.getDay()]);
var mydate=new Date();
var weekdays=["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
document.write(mydate.getFullYear());
document.write(mydate.getMonth()+1);
document.write(mydate.getDate());
document.write(weekdays[mydate.getDay()]);
注意看weekdays的结束分号,是中文的!
数组初始化时多了空格吧,去掉空格就好啦,var weekdays=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
mydate.getMonth());
-->
mydate.getMonth()) +1;
还有“年”,“月”,“日”这几个字没有输出
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题