var myDate = new Date();
var weekDays = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]
document.write(myDate.getFullYear() + "年" + myDate.setMonth(5) + "月" + myDate.getDay() + "日" + weekDays[myDate.getDay()]);
</script>
这串代码中为什么输出的月份是一串数字呢?
setMonth()没有返回值呀,改成myDate.getMonth()就显示正确了
你给了 myDate.setMonth() 参数了