问答详情
源自:7-23 编程练习

大家帮忙找找哪错了

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); 帮我找找哪错了,怎么输不出来东西呢?谢谢

提问者:慕粉2039591405 2017-02-26 19:33

个回答

  • 优昙华院_稻叶
    2017-02-26 19:46:13

    <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中输出