11.2 处理周中的日期

    <script>
        window.onload = initDate;
        function initDate() {
            var now = new Date();
            var index = now.getDay();
            if (index < 6) {
                document.body.appendChild(document.createTextNode("工作日"));
            } else {
                document.body.appendChild(document.createTextNode("周末"));
            }
        }
    </script>