hellocy64
2016-05-23 19:45
var mydate=new Date(); var year=mydate.getFullYear(); var month=mydate.getMonth(); var weekday=["周日","周一","周二","周三","周四","周五","周六"]; var num=mydate.getDay(); document.write(year+month+weekday[num]); 为什么我这个显示不出来,求指导错误~谢谢
var weekday=["周日","周一","周二","周三","周四","周五","周六"];
这句话中的逗号和分号用错了,你使用的都是中文字符的标点符号,应改成英文的标点符号。
还有
document.write(year+month+weekday[num]);
改成:
document.write(year+"年"+month+"月"+ weekday[num]);
var weekday=["周日","周一","周二","周三","周四","周五","周六"];//这一行的标点符号错了,应该是英文状态下的
+只能连接字符串吧
JavaScript进阶篇
468060 学习 · 21891 问题
相似问题