码迷,mamicode.com
首页 > 编程语言 > 详细

JavaScript 获取星期几函数

时间:2015-05-30 17:53:32      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:


function getDayofWeek() {
            var day = "";
            var time = new Date();
            var numOfWeek = time.getDay();
            switch (numOfWeek) {
                case 0:
                    day = "星期日";
                    break;
                case 1:
                    day="星期一";
                    break;
                case 2:
                    day = "星期二";
                    break;
                case 3:
                    day = "星期三";
                    break;
                case 4:
                    day = "星期四";
                    break;
                case 5:
                    day = "星期五";
                    break;
                case 6:
                    day = "星期六";
                    break;
            }
            document.getElementByIdx_x("DayOfWeek").innerHTML = day;
        }
    </script>

<body onload="getDayofWeek()"></body>

 

JavaScript 获取星期几函数

标签:

原文地址:http://www.cnblogs.com/dullbaby/p/4540574.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!