隔壁外卖

第二十二天

今天打了一段关于输出星期问题。

    输出星期
    var myDate=new Date();
    var week=myDate.getDay();
    var str='今天是';
    switch (week) {
            case 1:
            str+='星期一'
            break;        
            case 2:
            str+='星期二'
            break;        
            case 3:
            str+='星期三'
            break;        
            case 4:
            str+='星期四'
            break;
            case 5:
            str+='星期五'
            break;
            case 6:
            str+='星期六'
            break;
            default:
            str+='星期天'
            break;
    }
     document.writeln(str);

 

posted on 2016-12-08 20:14  隔壁外卖  阅读(69)  评论(1编辑  收藏  举报

导航