大家帮忙找找哪错了

来源:7-23 编程练习

慕粉2039591405

2017-02-26 19:33

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

写回答 关注

1回答

  • 优昙华院_稻叶
    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中输出

JavaScript进阶篇

本课程从如何插入JS代码开始,带您进入网页动态交互世界

468194 学习 · 21891 问题

查看课程

相似问题