src/main/webapp/jquery-easyui-1.3.3/src/jquery.calendar.js
/**
     * show the select menu that can change year or month, if the menu is not be created then create it.
     */
show the select menu that can change year or month, if the menu is not be created then create it.
show the select menu that can change year or month if the menu is not be created then create it .
function showSelectMenus(target) {
        var opts = $.data(target, 'calendar').options;
        $(target).find('.calendar-menu').show();
        if ($(target).find('.calendar-menu-month-inner').is(':empty')) {
            $(target).find('.calendar-menu-month-inner').empty();
            var t = $('<table></table>').appendTo($(target).find('.calendar-menu-month-inner'));
            var idx = 0;
            for (var i = 0; i < 3; i++) {
                var tr = $('<tr></tr>').appendTo(t);
                for (var j = 0; j < 4; j++) {
                    $('<td class="calendar-menu-month"></td>').html(opts.months[idx++]).attr('abbr', idx).appendTo(tr);
                }
            }
            $(target).find('.calendar-menu-prev,.calendar-menu-next').hover(
                function () {
                    $(this).addClass('calendar-menu-hover');
                },
                function () {
                    $(this).removeClass('calendar-menu-hover');
                }
            );
            $(target).find('.calendar-menu-next').click(function () {
                var y = $(target).find('.calendar-menu-year');
                if (!isNaN(y.val())) {
                    y.val(parseInt(y.val()) + 1);
                }
            });
            $(target).find('.calendar-menu-prev').click(function () {
                var y = $(target).find('.calendar-menu-year');
                if (!isNaN(y.val())) {
                    y.val(parseInt(y.val() - 1));
                }
            });
            $(target).find('.calendar-menu-year').keypress(function (e) {
                if (e.keyCode == 13) {
                    setDate();
                }
            });
            $(target).find('.calendar-menu-month').hover(
                function () {
                    $(this).addClass('calendar-menu-hover');
                },
                function () {
                    $(this).removeClass('calendar-menu-hover');
                }
            ).click(function () {
                var menu = $(target).find('.calendar-menu');
                menu.find('.calendar-selected').removeClass('calendar-selected');
                $(this).addClass('calendar-selected');
                setDate();
            });
        }
        function setDate() {
            var menu = $(target).find('.calendar-menu');
            var year = menu.find('.calendar-menu-year').val();
            var month = menu.find('.calendar-selected').attr('abbr');
            if (!isNaN(year)) {
                opts.year = parseInt(year);
                opts.month = parseInt(month);
                show(target);
            }
            menu.hide();
        }
        var body = $(target).find('.calendar-body');
        var sele = $(target).find('.calendar-menu');
        var seleYear = sele.find('.calendar-menu-year-inner');
        var seleMonth = sele.find('.calendar-menu-month-inner');
        seleYear.find('input').val(opts.year).focus();
        seleMonth.find('td.calendar-selected').removeClass('calendar-selected');
        seleMonth.find('td:eq(' + (opts.month - 1) + ')').addClass('calendar-selected');
        sele._outerWidth(body._outerWidth());
        sele._outerHeight(body._outerHeight());
        seleMonth._outerHeight(sele.height() - seleYear._outerHeight());
    }
function showSelectMenus ( target ) { var opts = $ . data ( target , 'calendar' ) . options ; $ ( target ) . find ( '.calendar-menu' ) . show ( ) ; if ( $ ( target ) . find ( '.calendar-menu-month-inner' ) . is ( ':empty' ) ) { $ ( target ) . find ( '.calendar-menu-month-inner' ) . empty ( ) ; var t = $ ( '<table></table>' ) . appendTo ( $ ( target ) . find ( '.calendar-menu-month-inner' ) ) ; var idx = 0 ; for ( var i = 0 ; i < 3 ; i ++ ) { var tr = $ ( '<tr></tr>' ) . appendTo ( t ) ; for ( var j = 0 ; j < 4 ; j ++ ) { $ ( '<td class="calendar-menu-month"></td>' ) . html ( opts . months [ idx ++ ] ) . attr ( 'abbr' , idx ) . appendTo ( tr ) ; } } $ ( target ) . find ( '.calendar-menu-prev,.calendar-menu-next' ) . hover ( function ( ) { $ ( this ) . addClass ( 'calendar-menu-hover' ) ; } , function ( ) { $ ( this ) . removeClass ( 'calendar-menu-hover' ) ; } ) ; $ ( target ) . find ( '.calendar-menu-next' ) . click ( function ( ) { var y = $ ( target ) . find ( '.calendar-menu-year' ) ; if ( ! isNaN ( y . val ( ) ) ) { y . val ( parseInt ( y . val ( ) ) + 1 ) ; } } ) ; $ ( target ) . find ( '.calendar-menu-prev' ) . click ( function ( ) { var y = $ ( target ) . find ( '.calendar-menu-year' ) ; if ( ! isNaN ( y . val ( ) ) ) { y . val ( parseInt ( y . val ( ) - 1 ) ) ; } } ) ; $ ( target ) . find ( '.calendar-menu-year' ) . keypress ( function ( e ) { if ( e . keyCode == 13 ) { setDate ( ) ; } } ) ; $ ( target ) . find ( '.calendar-menu-month' ) . hover ( function ( ) { $ ( this ) . addClass ( 'calendar-menu-hover' ) ; } , function ( ) { $ ( this ) . removeClass ( 'calendar-menu-hover' ) ; } ) . click ( function ( ) { var menu = $ ( target ) . find ( '.calendar-menu' ) ; menu . find ( '.calendar-selected' ) . removeClass ( 'calendar-selected' ) ; $ ( this ) . addClass ( 'calendar-selected' ) ; setDate ( ) ; } ) ; } function setDate ( ) { var menu = $ ( target ) . find ( '.calendar-menu' ) ; var year = menu . find ( '.calendar-menu-year' ) . val ( ) ; var month = menu . find ( '.calendar-selected' ) . attr ( 'abbr' ) ; if ( ! isNaN ( year ) ) { opts . year = parseInt ( year ) ; opts . month = parseInt ( month ) ; show ( target ) ; } menu . hide ( ) ; } var body = $ ( target ) . find ( '.calendar-body' ) ; var sele = $ ( target ) . find ( '.calendar-menu' ) ; var seleYear = sele . find ( '.calendar-menu-year-inner' ) ; var seleMonth = sele . find ( '.calendar-menu-month-inner' ) ; seleYear . find ( 'input' ) . val ( opts . year ) . focus ( ) ; seleMonth . find ( 'td.calendar-selected' ) . removeClass ( 'calendar-selected' ) ; seleMonth . find ( 'td:eq(' + ( opts . month - 1 ) + ')' ) . addClass ( 'calendar-selected' ) ; sele . _outerWidth ( body . _outerWidth ( ) ) ; sele . _outerHeight ( body . _outerHeight ( ) ) ; seleMonth . _outerHeight ( sele . height ( ) - seleYear . _outerHeight ( ) ) ; }
show the select menu that can change year or month, if the menu is not be created then create it.
show the select menu that can change year or month if the menu is not be created then create it .