首页 > 代码库 > select分组,text缩进

select分组,text缩进

查询手术房:

        /**
         * 查询手术房
         */
        function queryRoom(x){
            $.post('/hospital1/ssgl/ssglAction.jsp',
            {
                'mode':'queryRoom'
            },
            function(result){
                var room = eval("("+result+")");
                $('#room').append($('<option/>').attr('value', 'null').text('==请选择=='));
                $.each(room, function(i,rm) {
                    if(i==0){
                        $('#room').append($('<optgroup/>').attr('label',rm[2]));
                    } else if(i>0 && (room[i-1][2]!=room[i][2])){
                        $('#room').append($('<optgroup/>').attr('label',rm[2]));
                    }
                    $('#room').append($('<option/>').attr('value', rm[0]).html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+rm[1]));
                });
                $('#room').val(x);
            });
        }


select分组,text缩进