var mydate=new Date(); var year=mydate.getFullYear(); var month=mydate.getMonth()+1; var day=mydate.getDate(); var myarr=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]; var week=myarr[mydate.getDay()]; document.write(year+"年"+month+"月"+day+"日 星期"+week); 帮我找找哪错了,怎么输不出来东西呢?谢谢
<meta charset="utf-8">
<script>
var mydate = new Date();
var year = mydate.getFullYear();
var month = mydate.getMonth() + 1;
var day = mydate.getDate();
var myarr = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var week = myarr[mydate.getDay()];
document.write(year + "年" + month + "月" + day + "日" +week);
</script>
//<script>标签没加,最好在html中输出