<script type="text/javascript">
        var curMonth = new Date();
        function initDate() {
            var month = curMonth.getFullYear() + '' + (curMonth.getMonth() + 1) + '';
            document.getElementById('month').innerHTML = month;
        }
        //上一月
        function preMonth() {
            var month = curMonth.getMonth() - 1;
            curMonth.setMonth(month);
            initDate();
        }
        //下一月
        function nextMonth() {
            var month = curMonth.getMonth() + 1;
            curMonth.setMonth(month);
            initDate();
        }
        //本月
        function currentMonth() {
            curMonth = new Date();
            initDate();
        }
    </script>

 

相关文章: